@media (min-width: 801px) {
  .install-hint { display: none !important; }
}

@media (max-width: 800px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding:
      calc(0.55rem + env(safe-area-inset-top))
      0.75rem
      0.55rem;
  }

  .nav {
    position: fixed;
    z-index: 5;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    gap: 0.5rem;
    background: var(--green-deep);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.35rem 0.75rem calc(0.45rem + env(safe-area-inset-bottom));
  }

  .nav a {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 5.25rem;
    padding: 0.4rem 0.85rem;
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .nav-wide { display: none; }
  .nav-narrow { display: inline; }

  #identity-name { display: none; }

  .identity { padding: 0.28rem; }

  .inbox-panel {
    position: fixed;
    top: calc(3.5rem + env(safe-area-inset-top));
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
    max-height: min(70dvh, calc(100dvh - 8.5rem - env(safe-area-inset-bottom)));
  }

  main {
    width: min(1080px, calc(100% - 1rem));
    padding: 1rem 0 calc(5.4rem + env(safe-area-inset-bottom));
  }

  h1 { font-size: 1.55rem; }

  .status { padding-left: 0.75rem; padding-right: 0.75rem; }

  input, select, textarea { font-size: 16px; }

  .split, .pair, dl { grid-template-columns: 1fr; }

  .slot { grid-template-columns: 1fr 1fr; }

  .slot .field:last-child { grid-column: 1 / -1; }

  .hall-summary { align-items: flex-start; }

  .request-head { flex-wrap: wrap; align-items: flex-start; }

  .request-head strong { white-space: normal; }

  .request-head .actions { flex-wrap: wrap; }

  .person .who span,
  .opponent .who span { overflow-wrap: anywhere; }

  .meeting.ticket {
    grid-template-columns: 1fr auto;
  }

  .ticket-hall,
  .meeting.ticket > button { grid-column: 1 / -1; }

  .ticket-note-form { flex-wrap: wrap; }

  #check-btn,
  #open-request,
  form > button,
  .gate .button { width: 100%; }

  button,
  .button { min-height: 2.75rem; }

  .outcome button,
  .relation button,
  .meeting button,
  .skip-row button,
  .match-row > button,
  .match-row .phone-row button,
  .request-card .actions a,
  .request-card .actions button,
  .inbox li.person-row button,
  #history-more,
  .install-hint button,
  .group-person button,
  .group-add button,
  .session-person button {
    min-height: 2.25rem;
  }

  .session-person button { width: auto; }

  .group-add button { width: auto; }
}

.day-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.day-strip button { flex: 0 0 auto; }

.day-strip button[aria-pressed="true"] {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.day-strip button.has-booking {
  flex-direction: column;
  gap: 0.15rem;
}

.day-strip button.has-booking::after {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--green);
}

.day-strip button.has-booking[aria-pressed="true"]::after {
  background: #fff;
}

.day-timing {
  display: grid;
  gap: 0.4rem;
  margin: 0.15rem 0 0.9rem;
}

button.timing-slot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.12rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  text-align: left;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
}

button.timing-free {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
}

button.timing-busy {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
}

.timing-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

button.timing-busy::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  flex: none;
}

button.timing-busy[aria-expanded="true"] {
  border-radius: 14px 14px 0 0;
}

button.timing-busy[aria-expanded="true"]::after {
  transform: translateY(0.12rem) rotate(-135deg);
}

.timing-body {
  padding: 0.15rem 0.75rem 0.75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-left: 3px solid var(--green);
  border-radius: 0 0 14px 14px;
}

.timing-body .session-people { margin-top: 0.35rem; }

.timing-body > button,
.timing-detail > button {
  width: 100%;
  margin-top: 0.7rem;
}

.timing-when {
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.timing-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.month-jump {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.coach-block { margin-top: 1.25rem; }

.session-row {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.session-row:last-child { border-bottom: 0; }

.session-time {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.session-meta { margin: 0.15rem 0 0; color: var(--ink); }

.session-people {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.session-person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
}

.session-person p { margin: 0; }

.session-person .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.session-person button {
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 999px;
}

.checks {
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}

.check-row,
.checks label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: auto;
  margin: 0;
  font-weight: 600;
}

.phone-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
}

.phone-row .phone { margin: 0; }

.phone-row button { flex: none; }

.match-row .phone-row button {
  padding: 0.32rem 0.55rem;
  font-size: 0.8rem;
  border-radius: 999px;
}

.student-card {
  display: grid;
  justify-items: start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#student-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

#student-list .empty { margin: 0; }

.group-note { margin-top: 0.35rem; }

#group-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

#group-list .empty { margin: 0; }

#group-form,
#student-form {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  margin: 1.15rem 0 0;
  padding: 1.05rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#group-form h3,
#student-form h3 { margin: 0; font-size: 1.05rem; }

#group-students { gap: 0.2rem; }

#group-students label { min-height: 2.25rem; }

.group-card {
  display: grid;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.group-card h3 { margin: 0; }

button.group-toggle,
button.section-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
}

.panel > h2 > button.section-toggle,
.form-card > h2 > button.section-toggle,
.form-card > h3 > button.section-toggle,
#group-form > h3 > button.section-toggle,
#student-form > h3 > button.section-toggle {
  padding: 0.15rem 0;
  min-height: 2.5rem;
}

button.group-toggle .group-title,
button.section-toggle .group-title {
  flex: 1;
  min-width: 0;
}

button.group-toggle::after,
button.section-toggle::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  flex: none;
}

button.group-toggle[aria-expanded="true"]::after,
button.section-toggle[aria-expanded="true"]::after {
  transform: translateY(0.12rem) rotate(-135deg);
}

.section-fields {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.section-fields > button[type="submit"] { width: 100%; }

.group-count {
  flex: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.group-people { display: grid; }

.group-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem 0.45rem 1rem;
  border-top: 1px solid var(--line);
}

.group-person span { font-weight: 600; }

.group-person button {
  flex: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.group-add {
  display: grid;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.75rem 1rem 0.9rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #f7f3eb;
  box-shadow: none;
}

.group-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.group-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.group-add-row select {
  width: auto;
  flex: 1 1 10rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
}

.group-add-row button { flex: none; min-height: 2.5rem; }

button.group-delete {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.92rem;
}

.student-mail { margin: 0; font-size: 0.92rem; }

.student-card .who {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
}

#coach-disable { margin-top: 1rem; }

.hall-city {
  margin: 0.85rem 0 0.15rem;
  padding: 0;
  list-style: none;
  font-weight: 500;
}

.coach-practice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}

.coach-practice strong {
  font-weight: 500;
}

.practice-toggle {
  width: auto;
}

.practice-split,
.practice-days {
  margin: 0.35rem 0 0;
}

.practice-days {
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.player-card {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  max-width: 240px;
  min-width: 0;
  padding: 16px 16px 14px;
  border: 1px solid #146b45;
  border-radius: 18px;
  background: #0c3d28;
  color: #f3efe6;
}

.player-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 240px));
  gap: 12px;
  margin: 0.35rem 0 0.2rem;
}

.player-pair-lead {
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-weight: 500;
}

.player-card p { margin: 0; color: #d7ebe0; }

.player-card .player-card-rating {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #f0c14b;
}

.player-card-system {
  margin-top: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.player-card .avatar {
  width: 64px;
  height: 64px;
  margin: 16px 0 12px;
  background: #f3efe6;
  color: #0c3d28;
  font-size: 1.6rem;
  font-weight: 500;
}

.player-card-given { font-size: 0.95rem; }

.player-card .player-card-family {
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #f3efe6;
}

.player-card-level { margin-top: 4px; }

.player-card dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(243, 239, 230, 0.28);
}

.player-card dt { color: #d7ebe0; }

.player-card dd {
  margin: 0;
  text-align: right;
  color: #f3efe6;
}

.player-card .player-card-rating.is-word {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: #f3efe6;
}

.player-card-link {
  margin-top: 12px;
  color: #f0c14b;
  font-size: 0.9rem;
}

.match-row .player-card p,
.request-card .player-card p { color: #d7ebe0; }

.match-row .player-card .player-card-rating,
.request-card .player-card .player-card-rating { color: #f0c14b; }

.match-row .player-card .player-card-rating.is-word,
.request-card .player-card .player-card-rating.is-word { color: #f3efe6; }

.match-row .player-card .player-card-family,
.request-card .player-card .player-card-family,
.match-row .player-card dd,
.request-card .player-card dd { color: #f3efe6; }

