:root {
  --navy: #16305c;
  --navy-light: #24467f;
  --accent-orange: #f5a623;
  --accent-orange-dark: #d98c00;
  --required-red: #e5484d;
  --bg: #f4f6fa;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #dde3ee;
  --success-green: #16a34a;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Header */
.app-header {
  background: var(--navy);
  color: #fff;
  padding: 16px 20px 14px;
}

.app-header__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin-bottom: 6px;
}

.tournament-banner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
}

.tournament-banner__date {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
}

.tournament-banner__name {
  font-size: 16px;
}

/* Step indicator */
.steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 12px 12px;
  gap: 2px;
}

.steps.is-hidden {
  display: none;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  width: 54px;
}

.step__circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #dfe6f2;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.step__label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.25;
}

.step__line {
  flex: 1 1 auto;
  height: 2px;
  background: #dfe6f2;
  margin-top: 14px;
  min-width: 8px;
}

.step.is-active .step__circle,
.step.is-done .step__circle {
  background: var(--navy);
  color: #fff;
}

.step.is-active .step__label,
.step.is-done .step__label {
  color: var(--navy);
  font-weight: 700;
}

.step__line.is-done {
  background: var(--navy);
}

/* Panels */
.panels {
  flex: 1;
  padding: 8px 20px 24px;
}

.panel {
  display: none;
  animation: fadeIn 0.18s ease;
}

.panel.is-active {
  display: block;
}

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

.panel__title {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__title-icon {
  font-size: 22px;
  line-height: 1;
}

.badge-required {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--required-red);
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-public,
.badge-optional {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  white-space: nowrap;
}

.badge-public {
  color: #fff;
  background: var(--success-green);
}

.badge-optional {
  color: var(--text-muted);
  background: #e2e8f0;
}

.panel__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

/* Text input */
.text-input {
  width: 100%;
  font-size: 18px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.text-input:focus {
  border-color: var(--navy-light);
}

.nickname-field {
  margin-bottom: 14px;
}

.nickname-next-btn {
  width: 100%;
  margin-top: 4px;
}

.support-only-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: #fff6e6;
  border: 1.5px solid var(--accent-orange-dark);
  border-radius: 10px;
  cursor: pointer;
}

.support-only-toggle input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.support-only-toggle__text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.support-only-toggle__desc {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.message-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Select input */
.select-input {
  width: 100%;
  font-size: 17px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path fill='%236b7280' d='M5 8l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.select-input:focus {
  border-color: var(--navy-light);
}

.last-practice-wrap {
  margin-top: 18px;
}

.last-practice-wrap.is-hidden {
  display: none;
}

.last-practice-wrap .select-input {
  margin-bottom: 20px;
}

.subsection {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #eef2fa;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  touch-action: manipulation;
}

.accordion-toggle__label {
  text-align: left;
}

.accordion-content {
  margin-top: 16px;
}

.accordion-content.is-collapsed {
  display: none;
}

.training-intensity-wrap {
  margin-top: 16px;
}

.training-intensity-wrap.is-hidden {
  display: none;
}

.practice-calendar {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.practice-calendar__month {
  flex: 1 1 0;
  min-width: 0;
}

.practice-calendar__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-bottom: 6px;
}

.practice-calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.practice-calendar__weekday {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.practice-calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.practice-day-cell {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.practice-day-cell.is-empty {
  border: none;
  background: transparent;
  cursor: default;
}

.practice-day-cell.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.practice-day-cell.is-today {
  border-color: var(--accent-orange-dark);
  border-width: 2px;
}

.practice-day-cell.is-selected {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.input-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Bulk action buttons */
.bulk-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.bulk-btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--navy-light);
  color: var(--navy-light);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.bulk-btn:active {
  background: #eef2fa;
}

/* Checkbox list */
.checkbox-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  touch-action: manipulation;
}

.check-item.is-checked {
  border-color: var(--navy-light);
  background: #eef2fa;
}

.check-item.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  background: #f4f6fa;
}

.check-item--full {
  grid-column: 1 / -1;
}

.check-list-divider {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  margin: 6px 0 2px;
}

.check-item__box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #c3cbdc;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 14px;
  color: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.check-item.is-checked .check-item__box {
  background: var(--navy-light);
  border-color: var(--navy-light);
}

.check-item__text {
  font-size: 16px;
  font-weight: 600;
}

/* Desired position buttons */
.position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.position-btn {
  padding: 16px 8px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  touch-action: manipulation;
}

.position-btn.is-selected {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.position-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.anywhere-wrap {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.anywhere-btn {
  width: 100%;
  padding: 18px 8px;
  font-size: 17px;
  font-weight: 800;
  border: 2px solid var(--accent-orange-dark);
  background: #fff6e6;
  color: var(--accent-orange-dark);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
  touch-action: manipulation;
}

.anywhere-btn__icon {
  font-size: 18px;
}

.anywhere-btn.is-selected {
  background: var(--accent-orange);
  color: #fff;
}

/* Confirm screen */
.confirm-section {
  margin-bottom: 8px;
}

.confirm-section__note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: #eef2fa;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  line-height: 1.6;
}

.confirm-section__icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.6;
}

.confirm-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.confirm-card.is-hidden {
  display: none;
}

.confirm-card__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.confirm-card__value {
  font-size: 16px;
  font-weight: 700;
}

.disclaimer {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: #eef2fa;
  border-radius: 10px;
  padding: 12px 14px;
  line-height: 1.6;
}

.disclaimer.is-hidden {
  display: none;
}

.error-message {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--required-red);
  background: #fdeceb;
  border-radius: 10px;
  padding: 12px 14px;
  line-height: 1.6;
}

.error-message.is-hidden {
  display: none;
}

/* Done screen */
.done-screen {
  text-align: center;
  padding: 48px 12px;
}

.done-screen__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-green);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.done-screen__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.done-screen__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.confirmation-code-box {
  margin-top: 28px;
  padding: 20px;
  background: #fff6e6;
  border: 2px solid var(--accent-orange-dark);
  border-radius: 14px;
}

.confirmation-code-box.is-hidden {
  display: none;
}

.confirmation-code-box__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-orange-dark);
  margin-bottom: 8px;
}

.confirmation-code-box__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-bottom: 10px;
}

.confirmation-code-box__hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.results-code-box {
  margin-top: 16px;
  padding: 20px;
  background: #eef2fa;
  border: 2px solid var(--navy);
  border-radius: 14px;
}

.results-code-box__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.results-code-box__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-bottom: 10px;
}

.results-code-box__hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.done-results-link {
  display: block;
  margin-top: 20px;
  text-align: center;
  text-decoration: none;
}

/* Entry screen: new vs edit */
.entry-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #eef2fa;
  border-radius: 10px;
}

.entry-notice.is-hidden {
  display: none;
}

.entry-notice__icon {
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1.6;
}

.entry-notice__text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.entry-notice__deadline {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-orange-dark);
}

.intro-block {
  margin-top: 16px;
  padding: 14px 16px;
  background: #eef2fa;
  border-radius: 12px;
}

.intro-block__title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.intro-block__text {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.intro-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.8;
}

.intro-steps li + li {
  margin-top: 6px;
}

.intro-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0 16px;
  padding: 12px 14px;
  background: #fff6e6;
  border: 1.5px solid var(--accent-orange-dark);
  border-radius: 10px;
  cursor: pointer;
}

.intro-agree input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.intro-agree__text {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.intro-next-btn {
  width: 100%;
}

.entry-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.entry-choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card-bg);
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
}

.entry-choice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.entry-choice-btn__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: var(--navy);
}

.entry-choice-btn--secondary .entry-choice-btn__icon {
  background: var(--accent-orange-dark);
}

.entry-choice-btn__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-choice-btn__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.entry-choice-btn__desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.entry-lookup {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}

.entry-lookup.is-hidden {
  display: none;
}

.lookup-code-input {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 10px;
}

.lookup-submit-btn {
  width: 100%;
  margin-top: 4px;
}

.lookup-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.lookup-result.is-hidden {
  display: none;
}

.lookup-result__text {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.lookup-result__hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.lookup-delete-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid #d64545;
  color: #d64545;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.results-access {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}

.results-access.is-hidden {
  display: none;
}

.results-access__hint {
  margin: 4px 0 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

#results-body.is-hidden {
  display: none;
}

.results-code-input {
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 10px;
}

.results-code-submit-btn {
  width: 100%;
  margin-top: 4px;
}

/* Footer nav */
.footer-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
}

.footer-nav.is-hidden {
  display: none;
}

.nav-btn {
  flex: 1;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

.nav-btn--back {
  flex: 0 0 96px;
  background: #eef2fa;
  color: var(--navy);
}

.nav-btn--next {
  background: var(--navy);
  color: #fff;
}

.nav-btn--next:disabled {
  background: #c3cbdc;
  cursor: not-allowed;
}

.nav-btn--back.is-hidden {
  display: none;
}

/* Results page */
.results-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin: 4px 0 12px;
}

.results-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.results-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.results-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.results-row__label {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.results-row__value {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

.results-message {
  padding: 8px 0 2px;
  border-top: 1px solid var(--border);
}

.results-message__text {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.state-message {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.results-back-link {
  display: block;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-light);
  text-decoration: none;
}

.results-back-link--pending {
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.6;
}
