.host-ui {
  --host-forest: var(--dark);
  --host-line: var(--line);
  --host-light: #f1f5eb;
  display: grid;
  gap: 15px;
}

.host-ui h1, .host-ui h2, .host-ui h3, .host-dialog h2, .host-dialog h3 {
  margin: 0;
  color: var(--host-forest, #153e34);
  line-height: 1.3;
}

.host-ui .btn, .host-dialog .btn {
  min-height: 44px;
  white-space: normal;
}

.host-overline {
  margin: 0 0 6px;
  color: #466951;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .13em;
}

.host-workspace-heading h1 {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.host-event-heading, .host-schedule-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.host-event-heading {
  align-items: center;
  margin: 4px 0 0;
}

.host-event-heading h1 {
  font-size: clamp(1.35rem, 4vw, 2.1rem);
  overflow-wrap: anywhere;
}

.host-event-heading .muted {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.host-event-actions { justify-content: flex-end; }
.host-venue-fields { display: grid; gap: 9px; min-width: 0; margin: 0; padding: 11px 13px; border: 1px solid var(--host-line); border-radius: 12px; }
.host-venue-fields legend { padding-inline: 6px; font-weight: 750; }
.host-venue-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 6px; }
.host-venue-toolbar h3 { display: flex; align-items: center; gap: 8px; }
.host-venue-editor { margin: 12px 0; background: var(--host-light); }
.host-venue-list { display: grid; gap: 9px; margin: 12px 0 0; padding: 0; list-style: none; }
.host-venue-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 12px; padding: 12px 14px; border: 1px solid var(--host-line); border-inline-start: 3px solid #86a260; border-radius: 10px; background: #f8faf5; }
.host-venue-info { flex: 1 1 230px; min-width: 0; }
.host-venue-info h4 { margin: 0 0 6px; font-size: 1rem; }
.host-venue-details { display: grid; gap: 4px; margin: 0; font-size: .85rem; }
.host-venue-details dt { color: var(--muted); font-weight: 700; }
.host-venue-details dd { margin: 0; white-space: pre-line; }
.host-venue-actions { flex: none; }
.host-schedule-heading { flex-wrap: wrap; }
.host-schedule-group { display: grid; gap: 10px; margin-top: 10px; }
.host-schedule-group h2 { display: flex; align-items: center; gap: 9px; font-size: 1.15rem; }
.host-schedule-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.host-schedule-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.host-schedule-card time { display: block; color: #40634c; font-size: .85rem; font-weight: 750; }
.host-schedule-card h3 { margin: 3px 0; overflow-wrap: anywhere; font-size: 1.16rem; }
.host-schedule-card .btn { flex: none; }
.host-create > .section-head { margin-bottom: 12px; }
.host-dialog > [data-host-form="edit"] + p { margin-top: 12px; }

.host-ui :where(.field input, .field select) {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  font-size: 1rem;
}

.host-form-grid {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.host-full { grid-column: 1 / -1; }

.host-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.host-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--host-line);
  border-radius: 12px;
  background: var(--host-light);
}

.host-tabs button {
  min-width: 0;
  min-height: 44px;
  padding: 5px 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #153e34;
  font: inherit;
  font-size: .85rem;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
}

.host-tabs button[aria-current="page"] {
  border-color: #153e34;
  background: #153e34;
  color: #fff;
}

.host-tab-icon { display: none; }
#host-session-panel { display: grid; gap: 15px; min-width: 0; }

.host-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.host-kpis > .card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  gap: 4px;
  padding: 12px;
  text-align: start;
}

.host-kpis > .card:hover { background: var(--host-light); }
.host-kpis > .card::after {
  content: '';
  grid-area: 1 / 2;
  width: 6px;
  height: 6px;
  margin: 5px 2px 0 0;
  border-top: 2px solid var(--host-forest);
  border-right: 2px solid var(--host-forest);
  transform: rotate(45deg);
}

.host-kpis .muted { font-size: .76rem; }
.host-kpis strong { grid-column: 1 / -1; color: var(--host-forest); font-size: clamp(1.15rem, 4vw, 1.65rem); overflow-wrap: anywhere; }

.host-today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.host-today-grid.is-empty { grid-template-columns: minmax(0, 1fr); }
.host-ui .practice-timer h3 { color: inherit; }
.practice-actions { display: grid; gap: 8px; margin-top: 8px; }
.host-ui .practice-actions > .btn { min-height: 54px; font-size: 1.1rem; }
.practice-action-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.practice-time-tools { display: grid; gap: 6px; padding-top: 11px; margin-top: 4px; border-top: 1px solid #9fbc9e70; }
.practice-time-tools > span { color: #d5e7dc; font-size: .82rem; font-weight: 750; }
.practice-reset { justify-self: start; padding: 0 5px; min-height: 44px; border: 0; background: transparent; color: #edf5e9; font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }
.practice-reset:focus-visible { outline-color: var(--lime); }
.practice-order-hint { margin-top: 7px; font-size: .82rem; }
.host-practice-list > li { position: relative; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.host-practice-list[data-practice-order] > li { grid-template-columns: 44px auto minmax(0, 1fr) auto; }
.host-practice-list > li > .btn { grid-column: 2 / -1; justify-self: start; }
.host-practice-list[data-practice-order] > li > .btn { grid-column: 3 / -1; }
.practice-drag { display: grid; place-items: center; min-height: 44px; padding: 0; border: 1px solid #bccfba; border-radius: 8px; background: #edf4e9; color: var(--host-forest); font-size: 1.45rem; cursor: grab; touch-action: none; user-select: none; }
.practice-drag:active { cursor: grabbing; }
.host-practice-list .is-dragging { opacity: .5; }
.host-practice-list :is(.is-drop-before,.is-drop-after)::before { position: absolute; z-index: 1; inset-inline: 0; height: 3px; border-radius: 3px; background: #36744c; content: ''; pointer-events: none; }
.host-practice-list .is-drop-before::before { top: -5px; }
.host-practice-list .is-drop-after::before { bottom: -5px; }

.host-list, .host-receipts { margin-top: 14px; }
.host-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--host-line);
}

.host-list-row small {
  display: block;
  color: #4d6759;
}

.host-roster-person { display: grid; gap: 2px; min-width: 0; }
.host-roster-person > small { margin-left: 0; }
.host-roster-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 5px; }
.host-checkin-actions { margin-top: 12px; }


.host-match-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.host-round { margin-top: 17px; }
.host-round h4 { margin: 0 0 8px; }
.host-match {
  padding: 12px;
  border: 1px solid var(--host-line);
  border-radius: 12px;
  background: #fff;
}

.host-match + .host-match { margin-top: 9px; }
.host-match-grid > .host-match { margin-top: 0; }
.host-match-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.host-court { background: #f1f5eb; border: 1px solid #d6e3d4; border-radius: 9px; }
.host-court-side { display: flex; justify-content: center; gap: 8px; padding: 8px; text-align: center; }
/* 参加者の表示（participant-label.css）を主催者画面の中で使うときの配置 */
.host-display-options { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.host-display-option { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--host-line); border-radius: 9px; cursor: pointer; }
.host-display-option input { width: 1.1rem; height: 1.1rem; accent-color: var(--host-forest); }
.host-net { border-top: 1px dashed #557d65; }
.host-score { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 6px; margin-top: 10px; }
.host-score-pending { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; }

.host-receipts { display: grid; gap: 8px; }
.host-receipts > .btn { justify-self: start; }
.host-receipt-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 46px;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--host-line);
  border-radius: 9px;
  cursor: pointer;
}

.host-receipt-row input { width: 1.1rem; height: 1.1rem; accent-color: var(--host-forest); }
.host-received-list { padding: 0; margin: 0; list-style: none; }
.host-received-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--host-line); }

.host-dialog {
  width: min(680px, calc(100% - 24px));
  max-width: none;
  max-height: min(88dvh, 780px);
  padding: 18px;
  border: 1px solid #dce5d8;
  border-radius: 15px;
  background: #fff;
  color: #18382f;
}

.host-dialog::backdrop { background: #142b24a0; }
.host-dialog > .section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.host-dialog h2 { font-size: clamp(1.05rem, 4vw, 1.4rem); }
.host-share-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.host-share-switch .btn[aria-pressed="true"] { color: #fff; background: var(--dark); border-color: var(--dark); }
.host-share-card { display: grid; gap: 8px; padding: 12px; border: 1px solid #dce5d8; border-radius: 10px; }
.host-share-card p { margin: 0; }
.host-share-card input { width: 100%; min-width: 0; min-height: 44px; font-size: 1rem; }
.host-qr { background: #fff; text-align: center; }
.host-qr svg { display: block; width: min(100%, 240px); height: auto; margin: auto; }
.host-share-code strong { display: inline-block; margin-inline-start: .45em; font-family: ui-monospace, monospace; font-size: 1.3rem; overflow-wrap: anywhere; }
.host-confirm-actions { display: flex; justify-content: end; }
.practice-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.practice-editor { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
.practice-editor-body, [data-practice-rows] { display: grid; align-content: start; gap: 16px; }
.practice-editor-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 5px 12px; }
.practice-editor-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.practice-editor-footer .error { flex: 1 1 220px; }
.practice-edit-row { display: grid; min-width: 0; gap: 10px; margin: 0; padding: 12px; border: 1px solid #b8cdb4; border-left: 4px solid #4d795a; border-radius: 12px; background: #edf4e9; box-shadow: 0 3px 7px #16372911; }
.practice-edit-row legend { padding: 0; }
.practice-edit-row legend span { display: block; padding: 4px 10px; border-radius: 6px; color: #fff; background: var(--dark); font-size: .79rem; font-weight: 750; }
.practice-edit-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, .35fr); gap: 9px; }
.practice-note { min-width: 0; border: 1px solid #d4e1d1; border-radius: 8px; background: #f5f8f2; }
.practice-note-summary { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px; border-radius: 7px; color: var(--muted); font-size: .82rem; cursor: pointer; list-style: none; }
.practice-note-summary::-webkit-details-marker { display: none; }
.practice-note-summary:hover { background: #eaf2e7; }
.practice-note-summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-inline-start: auto; margin-top: -3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.practice-note[open] > .practice-note-summary::after { margin-top: 3px; transform: rotate(225deg); }
.practice-note-indicator { font-size: .72rem; color: #4b654d; }
.practice-note > .field { padding: 3px 8px 8px; }
.practice-note textarea { min-height: 64px; border-color: #d4e1d1; resize: vertical; }
.practice-library { padding: 9px 12px; border: 1px solid #bfd1b8; border-radius: 12px; background: #f6f9ef; }
.practice-library > summary { display: list-item; min-height: 38px; padding: 7px 0; font-weight: 750; cursor: pointer; }
.practice-library-body { display: grid; gap: 8px; }
.practice-template-toolbar { display: grid; gap: 9px; padding: 10px 12px; border: 1px solid #d4e1d1; border-radius: 10px; background: #f6f9ef; }
.practice-template-draft { display: grid; gap: 16px; min-width: 0; }
.practice-template-actions { gap: 6px; }
.practice-template-actions .btn { padding-inline: 10px; font-size: .86rem; }
.practice-drill-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.practice-drill-list > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid #dce5d8; }
.practice-rank { display: grid; place-items: center; min-width: 28px; min-height: 28px; border-radius: 7px; background: #e3eddb; font-weight: 750; }
.host-practice-controls { display: grid; gap: 10px; min-width: 0; }
.host-sound { display: grid; gap: 8px; margin: 0; }
.host-sound legend { font-weight: 750; }
.host-sound-toggle, .host-sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.host-sound-toggle { min-height: 44px; cursor: pointer; }
.host-sound-toggle input { width: 1.1rem; height: 1.1rem; }
.host-sound-row .field { flex: 1 1 140px; }
.host-sound input[type="range"] { min-height: 44px; padding: 0; border: 0; accent-color: var(--dark); }

/* タブレットでも名簿や受付を狭い2列へ押し込めない。 */
.host-ui, .host-ui .card, .host-list-row > *, .host-roster-actions { min-width: 0; }
.host-ui input[type="search"], .host-dialog input[type="search"] { min-height: 48px; font-size: 16px; }
.host-roster-actions .btn { min-height: 48px; }
.host-ui .row { flex-wrap: wrap; }
@media (max-width: 1023px) {
  .host-today-grid { grid-template-columns: minmax(0, 1fr); }
  .host-event-heading { flex-wrap: wrap; }
  .host-event-actions { justify-content: flex-start; }
  .host-dialog { overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 599px) {
  .host-form-grid { grid-template-columns: minmax(0, 1fr); }
  .host-list-row { grid-template-columns: minmax(0, 1fr); padding-block: 14px; }
  .host-roster-actions { grid-column: 1 / -1; justify-content: start; width: 100%; gap: 8px; }
  .host-roster-actions .btn { flex: 1 1 8rem; padding-inline: 10px; }
  .host-dialog[open] { max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 20px); padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)); }
  .host-confirm-actions > .btn { width: 100%; min-height: 52px; }
  .host-score-pending { flex-wrap: wrap; }
}

@media (max-width: 680px) {
  :root:has(.host-tabs) {
    --host-nav-space: calc(5rem + env(safe-area-inset-bottom));
    scroll-padding-bottom: var(--host-nav-space);
  }
  body:has(.host-tabs) { padding-bottom: var(--host-nav-space); }
  body:has(.host-tabs) .global-toast { bottom: var(--host-nav-space); }
  .host-tabs {
    position: fixed;
    z-index: 20;
    inset: auto 0 0;
    padding: 5px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-width: 1px 0 0;
    border-radius: 0;
    background: var(--surface);
    box-shadow: 0 -6px 22px #16372916;
  }
  .host-tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 4px 2px;
    font-size: .76rem;
    text-wrap: balance;
  }
  .host-tab-icon { display: block; flex: none; width: 20px; height: 20px; }
  .host-tabs button span { display: grid; place-items: center; min-height: 2.4em; }
  #host-session-panel { scroll-margin-top: 12px; }
  .practice-dialog[open] { position: fixed; inset: auto 0 0; width: 100%; margin: 0; max-height: min(92dvh, 780px); border-radius: 16px 16px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .practice-editor-footer .btn { width: 100%; }
  .host-today-grid, .host-match-grid { grid-template-columns: minmax(0, 1fr); }
  .host-event-heading { align-items: start; flex-direction: column; }
  :is(.host-workspace-actions, .host-event-actions, .host-checkin-actions) { width: 100%; gap: 8px; }
  :is(.host-workspace-actions, .host-event-actions, .host-checkin-actions) > .btn {
    flex: 1 1 7.5rem;
    padding-inline: 8px;
    font-size: .88rem;
  }
}

@media (max-width: 430px) {
  .host-schedule-heading, .host-schedule-card { align-items: flex-start; flex-direction: column; }
  .host-schedule-card .btn { width: 100%; }
  .host-kpis > .card { padding: 9px; }
  .host-list-row { gap: 7px; }
  .host-roster-actions { grid-column: 1 / -1; justify-content: start; }
  .host-roster-actions .btn { flex: 1 1 7rem; font-size: .85rem; padding-inline: 8px; }
  .host-receipts > .btn { justify-self: stretch; }
  .host-received-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .host-received-list .btn { grid-column: 1 / -1; justify-self: start; }
  .host-score { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-score .btn { grid-column: 1 / -1; }
}

/* 参加者の検索・絞り込み・並び替え（画面契約_v1 §1-4、H5a・H5d） */
.host-finder { display: grid; gap: 10px; margin-top: 14px; }
.host-finder-search input { min-height: 48px; font-size: 16px; }
.host-finder-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 12px; }
.host-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.host-chip { min-height: 44px; padding: 6px 12px; border: 1px solid var(--host-line); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 700; cursor: pointer; }
.host-chip[aria-pressed="true"] { border-color: var(--navy, #172240); background: var(--navy, #172240); color: #fff; }
.host-chip-count { font-variant-numeric: tabular-nums; }
.host-finder-order { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.host-finder-order select { min-width: 0; }
.host-finder-order select { min-height: 44px; font-size: 16px; }
.host-finder-empty { display: grid; justify-items: start; gap: 8px; }
.host-receipt-list { display: grid; gap: 8px; }
.host-receipt-row.is-paid { cursor: default; opacity: .75; }
@media (max-width: 430px) {
  .host-finder-row { align-items: stretch; flex-direction: column; }
  .host-finder-order { justify-content: space-between; }
}
