* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --bg-dark: #fff;
  --bg-card: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
}

body,
button {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb { background: #b5c5c1; border-radius: 5px; }

/* Custom Dialog Styles */
.custom-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.5),
    0 8px 10px -6px rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.custom-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-dialog::backdrop {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.dialog-content {
  padding: 2rem;
}

.dialog-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
}

.dialog-message {
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 2rem;
  text-align: center;
}

.dialog-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.dialog-buttons .btn-primary,
.dialog-buttons .btn-secondary {
  flex: 1 1 0;
  min-width: 0;
  padding: 1rem;
  font-size: 1.1rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.dialog-buttons .btn-primary:active,
.dialog-buttons .btn-secondary:active {
  transform: scale(0.95);
}

.btn-secondary.unactive {
  opacity: 0.5;
  cursor: not-allowed;
}

h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 2000px;
  padding: 2rem;
}

/* Setup Container */
.setup-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 3rem;
  width: 100%;
  max-width: 900px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.setup-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.setup-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
  text-align: center;
}
.setup-title-date {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
  text-align: center;
  color: var(--bg-card);
}
.setup-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  text-align: center;
}

.index-a {
  display: flex;
  gap: 2rem;
  margin-top: 1.2rem;
  a {
    text-decoration: none;
    width: calc(100% / 3);
  }
}
/* Form */
/* 選択中の競技表示 */
.selected-competition-display {
  margin-bottom: 2rem;
}

.current-competition {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.current-competition-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.current-competition-name {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.competition-grid-container {
  margin-bottom: 2rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
}

.competition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  max-height: 450px;
  overflow-y: auto;
  padding: 0.5rem;
}

.competition-grid::-webkit-scrollbar {
  width: 6px;
}

.competition-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.competition-grid::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.competition-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60px;
}

.competition-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.competition-card.selected {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.competition-name {
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-primary);
  font-weight: 500;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  width: 100%;
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-secondary svg {
  transition: transform 0.3s ease;
}

.btn-secondary.active svg {
  transform: rotate(180deg);
}

.btn-warning {
  width: 100%;
  background: transparent;
  color: #f59e0b;
  border: 1px solid #f59e0b;
  border-radius: 0.75rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.1);
  transform: translateY(-2px);
}

.btn-warning:active {
  transform: scale(0.95);
  background: rgba(245, 158, 11, 0.15);
}

.btn-warning svg {
  transition: transform 0.3s ease;
}

.btn-warning:hover svg {
  transform: rotate(-30deg);
}

/* Quick Presets */
.quick-presets {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.presets-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  text-align: center;
}

.preset-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* Confirm Screen */
.confirm-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  color: white;
}

.confirm-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.confirm-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.confirm-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.confirm-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.confirm-note {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 2rem;
}

.confirm-note svg {
  color: var(--primary-color);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.confirm-note p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.flow-section {
  margin-top: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.completed-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #10b981;
  color: #ffffff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 0.9rem;
}

.color-card {
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
}

.color-card.green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.color-card.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.color-card.white {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #1f2937;
}
.color-card.yellow {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.color-card.orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.color-card.blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.color-card.selected {
  box-shadow: 0 0 0 3px var(--primary-color);
}

.rank-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
}

.rank-table th,
.rank-table td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.rank-table thead {
  background: rgba(255, 255, 255, 0.03);
}

.button-group {
  display: flex;
  gap: 1rem;
}

.button-group .btn-secondary,
.button-group .btn-warning,
.button-group .btn-primary {
  flex: 1 1 0;
  min-width: 0;
}

/* Step Indicators */
.step-indicators {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.indicator {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.indicator.active {
  background: var(--primary-color);
  width: 1.5rem;
  border-radius: 0.25rem;
}

.step-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }

  .setup-card {
    padding: 2rem 1.5rem;
  }

  .setup-title {
    font-size: 1.5rem;
  }

  .preset-buttons {
    flex-direction: column;
  }

  .preset-btn {
    width: 100%;
  }
}

/* Complete Page - 総合順位表 */
.rankings-container {
  margin: 0 1rem;
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--bg-card);
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--bg-card);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem 1rem 0 0;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.standings-table thead {
  background: var(--primary-color);
}

.standings-table th {
  padding: 1.25rem 1rem;
  text-align: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
}

.standings-table td {
  padding: 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.standings-table tbody tr:last-child td {
  border-bottom: none;
}
.ranking-footer {
  width: 100%;
  padding: 0 3rem 3rem;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0 0 1rem 1rem;
  overflow: hidden;
}
.rank-column {
  font-weight: 700;
  font-size: 1.8rem;
  width: 100px;
}

.standings-table tbody tr:nth-child(1) .rank-column {
  color: #f59e0b;
}

.standings-table tbody tr:nth-child(2) .rank-column {
  color: #9ca3af;
}

.standings-table tbody tr:nth-child(3) .rank-column {
  color: #d97706;
}

#classStandingsContainer {
  margin: 0;
}
.showclassranking {
  background-color: var(--bg-card);
  color: var(--bg-dark);
  margin: 0 1rem;
  border-radius: 1rem;
  font-size: 1.2rem;
}
.showclassranking summary {
  list-style: none;
  margin: 0 1rem;
  padding: 2rem 0;
  text-align: center;
}
.color-column {
  font-weight: 600;
  font-size: 1.5rem;
}

.color-badge-inline {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 700;
}

.color-badge-inline.green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.color-badge-inline.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.color-badge-inline.white {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #1f2937;
}
.color-badge-inline.yellow {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.color-badge-inline.orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.color-badge-inline.blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.points-column {
  font-weight: 700;
  font-size: 2rem;
  color: #60a5fa;
}

.action-buttons {
  margin-top: 3rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.update-info {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* 綱引き専用スタイル */
.court-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.court-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.court-card:hover:not(.completed) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.court-card.selected {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.completed-badge {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #10b981;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 9999px;
  z-index: 10;
  letter-spacing: 0.05em;
}

.court-card.completed {
  opacity: 0.5;
  background-color: rgba(15, 23, 42, 0.5);
  border-color: var(--border-color);
  cursor: not-allowed;
  pointer-events: none;
}

.court-card.completed .completed-badge {
  display: inline-block;
}

.court-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.court-classes {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.rank-selection-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin: 2rem 0;
}

.rank-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  scroll-margin-top: 2rem;
  transition: all 0.3s ease;
}

.rank-section[data-rank-id]:not([style*="display: none"]) {
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rank-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.rank-section-label {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  color: white;
}

.rank-section-label.rank-1st {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.rank-section-label.rank-2nd {
  background: linear-gradient(135deg, #9ca3af 0%, #4b5563 100%);
}
.rank-section-label.rank-3rd {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.rank-section-label.rank-4th {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.rank-section-label.rank-5th {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.selected-class-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-radius: 12px;
  min-width: 180px;
  text-align: center;
  border: 2px solid transparent;
}

.selected-class-display.has-selection {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
  border: 2px solid var(--primary-color);
}

.class-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem;
}

.class-button {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.class-button:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
}

.class-button:active:not(.disabled) {
  transform: scale(0.98);
}

.class-button.selected {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.class-button.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.01);
  border-color: var(--border-color);
}

@media (max-width: 768px) {
  .rank-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .selected-class-display {
    width: 100%;
    font-size: 1.8rem;
  }

  .class-selection-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1.25rem;
  }

  .class-button {
    padding: 1.75rem 1.25rem;
    font-size: 1.75rem;
    min-height: 70px;
  }

  .rank-section {
    padding: 1.5rem;
  }
}

.rank-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rank-label {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  color: white;
}

.rank-label.rank-1st {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.rank-label.rank-2nd {
  background: linear-gradient(135deg, #9ca3af 0%, #4b5563 100%);
}
.rank-label.rank-3rd {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.rank-label.rank-4th {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.rank-label.rank-5th {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.color-select {
  padding: 1.25rem;
  font-size: 1.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* アイコンの色をブルー（#2563eb）に変更 */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.5em 1.5em;
  padding-right: 3.5rem;
  font-weight: 600;
}

.color-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.color-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.75rem;
  font-size: 1.25rem;
}

.color-points-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.color-point-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-label {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
  color: white;
}

.color-label.color-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.color-label.color-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.color-label.color-white {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #1f2937;
}
.color-label.color-yellow {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.color-label.color-orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.color-label.color-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.rank-select {
  padding: 1rem;
  font-size: 1.25rem;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* アイコンの色をブルー（#2563eb）に変更 */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.5em 1.5em;
  padding-right: 3rem;
}

.rank-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.rank-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

.point-input {
  padding: 1rem;
  font-size: 1.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.point-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.button-group button {
  flex: 1;
}

@media (max-width: 768px) {
  .color-points-container {
    grid-template-columns: 1fr;
  }
}

/* 綱引き確認画面スタイル */
.tsunahiki-points-display {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.rank-results {
  display: flex;
  flex-direction: column;
}

.rank-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.result-rank {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  min-width: 100px;
  text-align: center;
}

.result-rank.rank-1st-badge {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.result-rank.rank-2nd-badge {
  background: linear-gradient(135deg, #9ca3af 0%, #4b5563 100%);
}
.result-rank.rank-3rd-badge {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.result-rank.rank-4th-badge {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.result-rank.rank-5th-badge {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.result-color {
  flex: 1;
  text-align: left;
  padding-left: 1rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}
.color-badge-small {
  margin: 0.5rem 0;
  padding: 0.5rem 2rem;
  border-radius: 8px;
}
.color-badge-small.green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.color-badge-small.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.color-badge-small.white {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #1f2937 !important;
}
.color-badge-small.yellow {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}
.color-badge-small.orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.color-badge-small.blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.rank-inline-list {
  display: contents;
  font-size: 1.3rem;
}
.rank-inline-value {
  font-weight: bold;
}
.result-points {
  font-size: 1.25rem;
  font-weight: 600;
  color: #60a5fa;
  min-width: 80px;
  text-align: right;
}

.points-title {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.points-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.point-display-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.rank-display {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 80px;
}

.point-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #60a5fa;
  margin-left: auto;
}

.point-label {
  font-size: 1rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .points-grid {
    grid-template-columns: 1fr;
  }
}

/* 送信画面スタイル */
.loading-spinner {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.success-icon,
.error-icon {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.success-title {
  color: #10b981 !important;
}

.error-title {
  color: #ef4444 !important;
}

.error-message {
  color: #ef4444;
}

.setup-badge.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.result-summary {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.summary-title {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-secondary);
}

.summary-value {
  font-weight: 600;
  color: var(--text-primary);
}

.points-summary {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.point-summary-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.summary-points {
  font-size: 1.25rem;
  font-weight: 700;
  color: #60a5fa;
  margin-left: auto;
}

@media (max-width: 768px) {
  .points-summary {
    grid-template-columns: 1fr;
  }
}

/* 順位表ローディング表示 */
.loading-message {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.loading-message p {
  margin-top: 1rem;
  font-size: 1.125rem;
  line-height: 1.8;
}

/* 2026 refresh: clear hierarchy and familiar desktop controls. */
:root {
  --primary-color: #17666a;
  --primary-dark: #104d51;
  --bg-dark: #f3f5f4;
  --bg-card: #ffffff;
  --text-primary: #172528;
  --text-secondary: #526469;
  --border-color: #d4dddb;
}

*, *::before, *::after { letter-spacing: 0; }
html { color-scheme: light; }
body { display: block; line-height: 1.55; }
button, input, select { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .52; }
:focus-visible { outline: 3px solid #267b80; outline-offset: 3px; }
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.setup-container { align-items: stretch; max-width: 860px; margin: 0 auto; }
.setup-card { max-width: none; border: 0; border-radius: 0; box-shadow: none; padding: 16px 0 48px; background: transparent; }
.app-kicker { color: var(--primary-color); font-size: .875rem; font-weight: 700; margin-bottom: 8px; }
.setup-title, .setup-title-date, .page-title { color: var(--text-primary); text-align: left; font-size: 1.9rem; line-height: 1.3; margin-bottom: 8px; }
.setup-description, .page-subtitle { color: var(--text-secondary); text-align: left; font-size: 1rem; margin-bottom: 28px; }
.setup-badge { background: #e5f0ed; color: #185a52; }
.selected-competition-display { margin-bottom: 16px; }
.current-competition { text-align: left; border: 1px solid var(--border-color); background: var(--bg-card); border-radius: 6px; padding: 18px 20px; margin-bottom: 0; }
.current-competition-label { color: var(--text-secondary); font-size: .85rem; margin-bottom: 4px; }
.current-competition-name { color: var(--text-primary); font-size: 1.25rem; }
#showMoreBtn { width: auto; min-width: 160px; margin-top: 12px; }
.competition-grid-container { animation: none; margin-bottom: 20px; }
.grid-description { text-align: left; font-size: .9rem; margin: 12px 0; }
.competition-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; max-height: 390px; padding: 2px; margin-bottom: 12px; }
.competition-card, .court-card, .class-button { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; transform: none; box-shadow: none; }
.competition-card { justify-content: flex-start; text-align: left; min-height: 64px; padding: 10px 14px; position: relative; }
.competition-card:hover, .court-card:hover:not(.completed), .class-button:hover:not(.disabled) { background: #edf4f1; border-color: var(--primary-color); transform: none; }
.competition-card.selected, .court-card.selected, .class-button.selected { background: #e4f1ed; border-color: var(--primary-color); box-shadow: inset 0 0 0 1px var(--primary-color); color: var(--text-primary); }
.competition-card.disabled, .court-card.completed { opacity: .55; background: #edf0ef; }
.completed-badge { color: #17534f; background: #d7e8e2; border-radius: 4px; }
.btn-primary, .btn-secondary, .btn-warning { border-radius: 6px; min-height: 46px; padding: 10px 16px; margin-top: 12px; text-decoration: none; transform: none; }
.btn-primary { background: var(--primary-color); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); }
.btn-secondary:hover { background: #eaf0ee; }
.btn-warning { color: #9c4f16; border-color: #b6743f; }
.index-a { gap: 8px; border-top: 1px solid var(--border-color); padding-top: 16px; margin-top: 24px; flex-wrap: wrap; }
.index-a a { width: auto; flex: 1 1 150px; margin-top: 0; }
.confirm-section, .rank-section, .result-summary { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
.confirm-section, .rank-section { border-top: 1px solid var(--border-color); }
.confirm-label { font-size: .85rem; }
.confirm-value { font-size: 1.25rem; }
.rank-progress { font-weight: 600; color: var(--primary-dark); padding: 10px 0; margin-bottom: 12px; }
#resetBtn { width: auto; margin: 0 0 12px; }
.color-grid { gap: 10px; }
.color-card, .color-card.green, .color-card.red, .color-card.white, .color-card.yellow, .color-card.orange, .color-card.blue { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 64px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-card); color: var(--text-primary); box-shadow: none; padding: 12px; font-weight: 700; }
.color-card::before { content: ""; display: block; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid #8a9998; background: var(--swatch); }
.color-card.green { --swatch: #39835a; }
.color-card.red { --swatch: #cf4b4b; }
.color-card.white { --swatch: #fff; }
.color-card.yellow { --swatch: #f2ca48; }
.color-card.orange { --swatch: #e68b40; }
.color-card.blue { --swatch: #4f81bf; }
.color-card:hover { transform: none; background: #f4f8f6; }
.color-card.selected { border-color: var(--primary-color); background: #e4f1ed; box-shadow: inset 0 0 0 1px var(--primary-color); }
.rank-badge { position: static; margin-left: auto; border: 0; background: var(--primary-color); color: white; border-radius: 4px; white-space: nowrap; min-width: 3em; }
.rank-table, .standings-table { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.rank-table thead, .standings-table thead { background: #e7ecea; }
.standings-table th { color: var(--text-primary); }
.rank-table th, .rank-table td, .standings-table th, .standings-table td { border-bottom: 1px solid var(--border-color); }
.rankings-container { margin: 0; }
.page-header { text-align: left; margin-bottom: 24px; }
.ranking-footer { background: transparent; border: 0; border-radius: 0; padding: 16px 0 32px; }
.showclassranking { color: var(--text-primary); background: transparent; border-top: 1px solid var(--border-color); border-radius: 0; margin: 0; }
.showclassranking summary { text-align: left; margin: 0; padding: 20px 0; cursor: pointer; }
.class-standings { border-top: 1px solid var(--border-color); padding-top: 28px; }
.class-standings-header h2 { font-size: 1.45rem; margin: 0 0 4px; }
.class-standings-header p { color: var(--text-secondary); margin: 0 0 20px; }
.class-standings-notice { padding: 12px 16px; background: #fff5e9; border-left: 3px solid #b6743f; margin: 0 0 18px; }
.grade-awards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grade-award { min-width: 0; min-height: 108px; padding: 14px 16px; text-align: left; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font: inherit; }
.grade-award:hover { border-color: var(--primary-color); background: #f4f8f6; }
.grade-award[aria-selected="true"] { border-color: var(--primary-color); box-shadow: inset 0 0 0 1px var(--primary-color); background: #e4f1ed; }
.grade-award:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.grade-award-label { font-size: .85rem; color: var(--text-secondary); font-weight: 700; }
.grade-award-name { font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; }
.grade-award-score { font-size: .9rem; color: var(--text-secondary); }
.grade-detail { padding: 22px 0 0; }
.grade-detail h3 { font-size: 1.15rem; margin: 0 0 10px; }
.grade-ranking-list { list-style: none; padding: 0; margin: 0; }
.grade-ranking-list li { display: grid; grid-template-columns: 52px minmax(50px, 1fr) 56px 90px; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-color); }
.grade-rank-number { font-weight: 700; color: var(--text-secondary); }
.grade-rank-name { font-weight: 700; }
.grade-rank-color { text-align: center; padding: 3px 6px; border-radius: 4px; border: 1px solid #8a9998; font-size: .85rem; }
.grade-rank-color.green { background: #39835a; color: white; }
.grade-rank-color.red { background: #cf4b4b; color: white; }
.grade-rank-color.white { background: #fff; color: var(--text-primary); }
.grade-rank-color.yellow { background: #f2ca48; color: var(--text-primary); }
.grade-rank-color.orange { background: #e68b40; color: var(--text-primary); }
.grade-rank-color.blue { background: #4f81bf; color: white; }
.grade-rank-points { text-align: right; }
.court-selection-grid { gap: 10px; }
.court-card { padding: 18px; }
.court-name { font-size: 1.5rem; }
.court-classes { font-size: 1rem; }
.rank-section-label, .rank-section-label.rank-1st, .rank-section-label.rank-2nd, .rank-section-label.rank-3rd, .rank-section-label.rank-4th, .rank-section-label.rank-5th { color: var(--text-primary); background: transparent; padding: 0; font-size: 1.25rem; }
.selected-class-display { background: #e7ecea; border-radius: 6px; color: var(--text-primary); }
.selected-class-display.has-selection { background: #e4f1ed; color: var(--primary-dark); }
.class-selection-grid { gap: 8px; }
.class-button { font-size: 1.3rem; min-height: 60px; }
.custom-dialog { background: var(--bg-card); border-radius: 8px; box-shadow: 0 14px 40px #0003; }
.custom-dialog::backdrop { background: #17252888; backdrop-filter: none; }
.dialog-title { color: var(--text-primary); }
.result-points, .point-value, .summary-points { color: var(--primary-color); }
.spinner { border-color: #d7e1de; border-top-color: var(--primary-color); }
.setup-badge.success { background: #e5f0ed; color: #185a52; }
.result-rank.rank-1st-badge, .result-rank.rank-2nd-badge, .result-rank.rank-3rd-badge, .result-rank.rank-4th-badge, .result-rank.rank-5th-badge { background: #dfe8e5; color: var(--text-primary); }
.color-badge-small.green { background: #39835a; }
.color-badge-small.red { background: #cf4b4b; }
.color-badge-small.white { background: #fff; border: 1px solid #8a9998; }
.color-badge-small.yellow { background: #f2ca48; color: var(--text-primary); }
.color-badge-small.orange { background: #e68b40; color: var(--text-primary); }
.color-badge-small.blue { background: #4f81bf; }
.color-badge-inline { border-radius: 4px; min-width: 3.5em; }
.color-badge-inline.green { background: #39835a; }
.color-badge-inline.red { background: #cf4b4b; }
.color-badge-inline.white { background: #f4f6f7; color: var(--text-primary); }
.color-badge-inline.yellow { background: #f2ca48; color: var(--text-primary); }
.color-badge-inline.orange { background: #e68b40; color: var(--text-primary); }
.color-badge-inline.blue { background: #4f81bf; }
@media (max-width: 640px) {
  .grade-awards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-award { min-height: 104px; padding: 12px; }
  .grade-ranking-list li { grid-template-columns: 38px minmax(38px, 1fr) 46px 66px; gap: 5px; font-size: .9rem; }
  .container { padding: 18px 16px 48px; }
  .setup-card { padding: 0 0 32px; }
  .setup-title, .setup-title-date, .page-title { font-size: 1.5rem; }
  .competition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button-group { gap: 8px; }
  .button-group > * { min-width: 0; }
  .rank-section-header { gap: 10px; }
  .standings-table th, .standings-table td { padding: 10px 6px; font-size: .95rem; }
}
