:root {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  color: #f4f7ff;
  background: #080d1c;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #080d1c;
  --panel: #11182d;
  --panel-2: #182241;
  --line: #2a385f;
  --line-soft: #202d4d;
  --text: #f5f7ff;
  --muted: #8f9ab9;
  --cyan: #12c8bd;
  --cyan-dark: #0f9d99;
  --yellow: #ffd84a;
  --red: #ef3d53;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(47, 65, 120, .28), transparent 38rem),
    linear-gradient(180deg, #0b1020 0%, #070b17 100%);
  overscroll-behavior-y: none;
}
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(18, 200, 189, .42); outline-offset: 2px; }

.app-shell { width: 100%; min-height: 100vh; margin: 0 auto; padding: 8px 12px 24px; }
.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(17, 24, 45, .92);
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
}
.brand-block { min-width: 0; }
.eyebrow { margin: 0 0 6px; color: #8c98b8; font-size: 9px; font-weight: 900; letter-spacing: .28em; }
.topbar h1 { margin: 0; color: #f7f8ff; font-size: clamp(17px, 2vw, 24px); line-height: 1.15; letter-spacing: .01em; white-space: nowrap; }
.topbar h1 span { color: #7481a4; font-size: .45em; }
.header-clock { display: grid; justify-items: center; line-height: 1; }
.header-clock time { color: #f8f9ff; font-size: clamp(46px, 6.2vw, 72px); font-weight: 900; letter-spacing: .035em; font-variant-numeric: tabular-nums; }
.header-clock span { margin-top: 4px; color: #7f8bab; font-size: 11px; font-weight: 700; }
.utility-button {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  color: #dce3f7;
  border: 1px solid #34456f;
  border-radius: 999px;
  background: #1b2543;
}
.utility-button.active { color: #08131e; border-color: var(--cyan); background: var(--cyan); }
.check-box { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 3px; background: #dbe4f7; color: #13213a; font-size: 13px; font-weight: 900; }
.utility-copy { display: flex; align-items: center; gap: 6px; }
.utility-copy strong { font-size: 11px; }
.utility-copy small { font-size: 10px; font-weight: 900; }

main { margin-top: 10px; }
.rooms-container { display: grid; gap: 8px; }
.floor-section { padding: 0; border: 0; background: transparent; }
.floor-heading { display: flex; align-items: center; gap: 10px; min-height: 25px; margin-bottom: 4px; }
.floor-heading span { min-width: 48px; color: #8995b3; font-size: 12px; font-weight: 900; text-align: right; }
.floor-heading div { width: 100%; height: 1px; background: #263354; }
.room-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding-left: 60px; }
.room-grid-two { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.room-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 10px;
  border: 1px solid #2c3a61;
  border-radius: 12px;
  background: linear-gradient(145deg, #1b274b, #151e39);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
  transition: background .2s ease, border-color .2s ease;
}
.room-card.idle { color: var(--text); }
.room-card.running { color: var(--text); border-color: #2a4673; background: linear-gradient(145deg, #1d2e59, #172444); }
.room-card.warning { color: #241b00; border-color: #f0c419; background: linear-gradient(145deg, #ffe77a, #ffc928); animation: warningPulse 1.2s ease-in-out infinite; }
.room-card.finished { color: white; border-color: #ff5368; background: linear-gradient(145deg, #ef4158, #a91831); animation: finishedFlash .75s ease-in-out infinite; }
.room-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-card h3 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); line-height: 1; letter-spacing: -.02em; }
.status-pill { padding: 4px 7px; border-radius: 999px; color: #98a4c2; background: rgba(255,255,255,.055); font-size: 9px; font-weight: 800; white-space: nowrap; }
.running .status-pill { color: #72e3dc; background: rgba(18,200,189,.13); }
.warning .status-pill { color: #594500; background: rgba(255,255,255,.42); }
.finished .status-pill { color: white; background: rgba(255,255,255,.18); }
.timer-label { display: block; margin-top: 9px; color: #8e9aba; font-size: 9px; font-weight: 700; }
.warning .timer-label, .finished .timer-label { color: currentColor; opacity: .75; }
.timer-display { margin: 4px 0 7px; color: var(--cyan); font-size: clamp(25px, 3.1vw, 38px); font-weight: 900; line-height: 1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warning .timer-display, .finished .timer-display { color: currentColor; }
.room-meta { display: grid; gap: 3px; min-height: 52px; }
.room-meta span { color: #8e9aba; font-size: 9px; font-weight: 700; }
.room-meta strong { display: grid; min-height: 36px; place-items: center; color: #f6f7ff; border: 1px solid #314268; border-radius: 8px; background: rgba(6,12,29,.38); font-size: clamp(19px, 2.3vw, 28px); font-variant-numeric: tabular-nums; }
.warning .room-meta span, .finished .room-meta span { color: currentColor; opacity: .72; }
.warning .room-meta strong, .finished .room-meta strong { color: currentColor; border-color: rgba(0,0,0,.15); background: rgba(255,255,255,.18); }
.course-selector-label { display: grid; gap: 6px; padding: 9px 0 6px; color: #a0abc6; font-size: 11px; font-weight: 800; }
.course-select { width: 100%; min-height: 48px; padding: 0 14px; color: #f4f7ff; border: 2px solid #3d5180; border-radius: 9px; background: #111a36; font-size: clamp(17px, 1.7vw, 22px); font-weight: 900; }
.course-select:disabled { opacity: .62; }
.warning .course-selector-label, .finished .course-selector-label { color: currentColor; opacity: .86; }
.warning .course-select, .finished .course-select { color: currentColor; border-color: rgba(0,0,0,.18); background: rgba(255,255,255,.18); }
.room-actions { display: grid; grid-template-columns: 1fr; gap: 5px; }
.room-actions button { width: 100%; min-width: 0; min-height: 27px; padding: 3px 4px; border-radius: 6px; font-size: 9px; font-weight: 900; }
.primary-action { color: #031816; border: 0; background: var(--cyan); }
.primary-action:active { background: var(--cyan-dark); }
.secondary-action { color: #dfe5f6; border: 1px solid #35466e; background: rgba(35,48,87,.75); }
.room-actions button:disabled { opacity: .38; }
.alarm-stop-button { color: #99172b; border: 0; background: white; }

.summary-card { min-width: 0; min-height: 100%; padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(17,24,45,.78); }
.basement-summary { align-self: stretch; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-title-row h2 { margin: 0; color: #eef2ff; font-size: 16px; }
.summary-badge, .text-button { padding: 5px 8px; border: 1px solid #33456f; border-radius: 999px; color: #aeb9d4; background: #192442; font-size: 10px; font-weight: 800; }
.text-button { cursor: pointer; }
.summary-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.summary-list li { display: grid; grid-template-columns: 22px 40px 1fr auto; align-items: center; gap: 6px; min-height: 32px; padding: 5px 7px; border: 1px solid #273759; border-radius: 8px; background: #131c34; color: #aab5cf; font-size: 11px; }
.summary-list li strong, .summary-list li time { color: #eef2ff; }
.summary-list .ranking { display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; background: #2b3b62; color: white; font-size: 9px; font-weight: 900; }
.summary-list .empty-row { display: block; color: #7783a2; text-align: center; }

footer { display: grid; gap: 8px; margin: 12px 0 0; text-align: center; }
footer p { margin: 0; color: #687492; font-size: 10px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; align-items: end; padding: 18px; background: rgba(1,5,15,.72); opacity: 0; backdrop-filter: blur(7px); transition: opacity .16s ease; }
.modal-backdrop.visible { opacity: 1; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(100%, 760px); max-height: min(88vh, 900px); margin: 0 auto; overflow: auto; padding: 20px; color: #16213a; border-radius: 22px 22px 12px 12px; background: #f7f9ff; box-shadow: 0 24px 80px rgba(0,0,0,.42); transform: translateY(20px); transition: transform .16s ease; }
.modal-backdrop.visible .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-header h2 { margin: 0; color: #101a31; font-size: 24px; }
.modal-close { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; color: #43506b; border: 0; border-radius: 50%; background: #e4e9f4; font-size: 28px; }
.modal-description { margin: 10px 0 16px; color: #63708b; line-height: 1.6; }
.course-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.course-button { display: flex; align-items: baseline; justify-content: center; gap: 3px; min-height: 58px; color: #10243d; border: 1px solid #cbd5e6; border-radius: 11px; background: #eef3fb; }
.course-button strong { font-size: 22px; }
.course-button span { font-size: 12px; font-weight: 800; }
.adjust-current { display: flex; align-items: center; justify-content: space-between; margin: 18px 0; padding: 16px; border-radius: 12px; background: #e9eff8; }
.adjust-current span { color: #65718a; font-weight: 700; }
.adjust-current strong { color: #10243d; font-size: 28px; }
.direct-input { display: grid; gap: 8px; margin-top: 18px; color: #5e6a84; font-size: 13px; font-weight: 800; }
.direct-input > div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; }
.direct-input input { min-width: 0; min-height: 54px; padding: 0 14px; color: #10243d; border: 2px solid #c8d2e4; border-radius: 11px; font-size: 22px; font-weight: 850; }
.direct-input button { min-height: 54px; padding: 0 20px; color: #041817; border: 0; border-radius: 11px; background: var(--cyan); font-weight: 900; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.confirm-actions button { min-height: 54px; border-radius: 12px; font-weight: 850; }
.cancel-button { color: #4d5b73; border: 1px solid #cbd4e2; background: #edf1f7; }
.confirm-reset-button { color: white; border: 0; background: var(--red); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 11px 16px; color: white; border-radius: 999px; background: rgba(14,25,48,.96); box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; font-size: 13px; font-weight: 800; text-align: center; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes warningPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.08); } }
@keyframes finishedFlash { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(.72); } }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .header-clock { grid-row: 1 / 3; grid-column: 2; }
  .utility-button { justify-self: start; }
  .room-grid { padding-left: 0; gap: 6px; }
  .floor-heading span { min-width: 40px; text-align: left; }
  footer { margin-left: 0; }
  .room-card { padding: 8px; }
  .room-actions button { font-size: 10px; }
}

@media (max-width: 700px) {
  .app-shell { padding-inline: 7px; }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; min-height: 74px; padding: 8px; }
  .topbar h1 { white-space: normal; font-size: 15px; }
  .header-clock time { font-size: 38px; }
  .header-clock span { display: none; }
  .utility-copy strong { display: none; }
  .room-grid, .room-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (orientation: landscape) and (max-height: 700px) {
  body::before { content: "このアプリはiPadの縦向きでの使用を推奨します"; position: fixed; z-index: 999; inset: 0 0 auto; padding: 7px; color: white; background: #9b1628; font-size: 12px; font-weight: 850; text-align: center; }
  .app-shell { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mode-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(132, 157, 225, .3);
  border-radius: 999px;
  background: rgba(39, 54, 98, .65);
  color: #f6f8ff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.login-panel {
  display: grid;
  gap: 16px;
  text-align: center;
}

.login-panel h2 { margin: 0; }

.pin-input {
  width: min(100%, 320px);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(126, 151, 220, .4);
  border-radius: 12px;
  outline: none;
  background: #111a36;
  color: #fff;
  font: inherit;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .35em;
  text-align: center;
}

.pin-input:focus {
  border-color: #15c9c0;
  box-shadow: 0 0 0 3px rgba(21, 201, 192, .14);
}

.login-button {
  width: min(100%, 320px);
  min-height: 48px;
  margin: 0 auto;
}

.pin-error {
  min-height: 1.4em;
  margin: 0;
  color: #ff7b8e;
  font-weight: 800;
}

.viewer-mode .room-actions button,
.viewer-mode #clearEndedButton {
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .header-actions { flex-wrap: wrap; }
  .mode-button { min-height: 34px; padding-inline: 10px; }
}

/* v12.6: iPad Pro 12.9-inch portrait layout */
.room-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.room-actions .reset-button {
  grid-column: 1 / -1;
  width: 100%;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: 6px 8px 8px;
  }

  .topbar {
    min-height: 64px;
    padding: 4px 12px;
  }

  .header-clock time {
    font-size: 48px;
  }

  .header-clock span {
    margin-top: 1px;
    font-size: 9px;
  }

  main {
    margin-top: 5px;
  }

  .rooms-container {
    gap: 3px;
  }

  .floor-heading {
    min-height: 17px;
    margin-bottom: 2px;
  }

  .floor-heading span {
    font-size: 10px;
  }

  .room-grid {
    gap: 5px;
  }

  .room-card,
  .summary-card {
    padding: 6px;
    border-radius: 9px;
  }

  .room-card h3 {
    font-size: 22px;
  }

  .status-pill {
    padding: 3px 6px;
    font-size: 8px;
  }

  .timer-label {
    margin-top: 5px;
    font-size: 8px;
  }

  .timer-display {
    margin: 2px 0 4px;
    font-size: 28px;
  }

  .room-meta {
    gap: 2px;
    min-height: 39px;
  }

  .room-meta span {
    font-size: 8px;
  }

  .room-meta strong {
    min-height: 27px;
    border-radius: 6px;
    font-size: 20px;
  }

  .course-selector-label {
    gap: 3px;
    padding: 4px 0;
    font-size: 9px;
  }

  .course-select {
    min-height: 38px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 18px;
  }

  .room-actions {
    gap: 4px;
  }

  .room-actions button {
    min-height: 26px;
    padding: 2px 3px;
    font-size: 8px;
    line-height: 1.1;
  }

  .room-actions .reset-button,
  .room-actions .alarm-stop-button {
    min-height: 29px;
    font-size: 10px;
  }

  .section-title-row {
    margin-bottom: 4px;
  }

  .section-title-row h2 {
    font-size: 13px;
  }

  .summary-badge,
  .text-button {
    padding: 3px 6px;
    font-size: 8px;
  }

  .summary-list {
    gap: 3px;
  }

  .summary-list li {
    grid-template-columns: 18px 32px 1fr auto;
    gap: 4px;
    min-height: 25px;
    padding: 3px 5px;
    font-size: 9px;
  }

  .summary-list .ranking {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }

  footer {
    display: none;
  }
}


/* v12.7: 終了時は操作ボタン2個分の場所に大きな停止／リセットボタンを表示 */
.room-actions.single-action .start-button,
.room-actions.single-action .adjust-button {
  display: none;
}

.room-actions.single-action .reset-button {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  min-height: 34px;
  font-size: 11px;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-actions.single-action .reset-button {
    min-height: 31px;
    font-size: 10px;
  }
}

/* v12.8: 終了時のアラーム停止／リセットボタンをさらに大きく表示 */
.room-actions.single-action .reset-button {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.15;
}

.room-actions.single-action .alarm-stop-button,
.finished .room-actions.single-action .reset-button:not(:disabled) {
  font-weight: 950;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-actions.single-action .reset-button {
    min-height: 46px;
    padding: 6px 8px;
    font-size: 14px;
  }
}

/* v13.0: requested room controls and course adjustment display */
.course-summary {
  min-height: 22px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: clamp(13px, 1.45vw, 19px);
  font-weight: 950;
  letter-spacing: .01em;
  text-align: center;
}

.course-summary:empty { display: none; }

.room-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.room-actions .start-button,
.room-actions .adjust-button,
.room-actions .reset-button {
  grid-column: 1;
  width: 100%;
}

.room-actions button[hidden] { display: none !important; }

.room-actions.single-action .reset-button {
  min-height: 54px;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: clamp(15px, 1.8vw, 23px);
  line-height: 1.05;
}

.room-actions.single-action .alarm-stop-button {
  min-height: 68px;
  color: #fff;
  border: 3px solid rgba(255,255,255,.9);
  background: #c81732;
  box-shadow: 0 0 0 3px rgba(239,61,83,.28), 0 8px 22px rgba(92,0,15,.38);
  font-size: clamp(18px, 2.2vw, 28px);
  animation: alarmButtonPulse .8s ease-in-out infinite;
}

@keyframes alarmButtonPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.015); filter: brightness(1.2); }
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card {
    padding: 6px 7px;
  }

  .course-selector-label {
    gap: 3px;
    padding: 3px 0 2px;
  }

  .course-select {
    min-height: 39px;
    padding-inline: 8px;
    font-size: 16px;
  }

  .course-summary {
    min-height: 17px;
    font-size: 13px;
  }

  .room-actions {
    gap: 3px;
  }

  .room-actions button {
    min-height: 24px;
    padding: 2px 4px;
    font-size: 9px;
  }

  .room-actions.single-action .reset-button {
    min-height: 48px;
    font-size: 18px;
  }

  .room-actions.single-action .alarm-stop-button {
    min-height: 60px;
    font-size: 21px;
  }
}


/* v13.1: スタートボタンを縦に大きくし、iPadでも押しやすくする */
.room-card.idle .room-actions .start-button {
  min-height: 72px;
  padding: 12px 8px;
  border-radius: 12px;
  font-size: clamp(20px, 2.25vw, 30px);
  line-height: 1.1;
  font-weight: 950;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card.idle .room-actions .start-button {
    min-height: 58px;
    padding: 8px 6px;
    font-size: 20px;
  }
}

/* v13.2: コース選択と残り時間修正をスタートと同じ大きさに統一 */
.room-card.idle .course-select,
.room-card.running .room-actions .adjust-button,
.room-card.warning .room-actions .adjust-button {
  min-height: 72px;
  padding: 12px 8px;
  border-radius: 12px;
  font-size: clamp(20px, 2.25vw, 30px);
  line-height: 1.1;
  font-weight: 950;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card.idle .course-select,
  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: 58px;
    padding: 8px 6px;
    font-size: 20px;
  }
}

/* v13.3: 残り時間修正を少し小さくし、終了予定時刻を強調 */
.room-card.running .room-actions .adjust-button,
.room-card.warning .room-actions .adjust-button {
  min-height: 60px;
  padding: 9px 7px;
  border-radius: 11px;
  font-size: clamp(17px, 1.85vw, 25px);
}

.room-card.running .room-meta strong {
  min-height: 46px;
  color: #ffad32;
  border-color: rgba(255, 173, 50, .8);
  background: rgba(255, 146, 24, .09);
  box-shadow: inset 0 0 0 1px rgba(255, 199, 108, .12), 0 0 16px rgba(255, 145, 24, .16);
  font-size: clamp(28px, 3.35vw, 43px);
  font-weight: 950;
  letter-spacing: .025em;
}

.room-card.warning .room-meta strong {
  min-height: 46px;
  font-size: clamp(28px, 3.35vw, 43px);
  font-weight: 950;
  letter-spacing: .025em;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: 50px;
    padding: 6px 5px;
    font-size: 17px;
  }

  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: 34px;
    font-size: 27px;
  }
}

/* v13.5: iPad 12.9インチ縦画面で最下部が切れないよう、現在時刻の帯をさらに縮小 */
@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .topbar {
    min-height: 54px;
    padding: 2px 10px;
    border-radius: 12px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 8px;
  }

  .topbar h1 {
    font-size: 18px;
    line-height: 1.05;
  }

  .header-clock time {
    font-size: 43px;
    line-height: .95;
  }

  .header-clock span {
    margin-top: 0;
    font-size: 8px;
  }

  .utility-button,
  .mode-button {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

/* v13.6: 稼働開始後はコース選択欄を隠し、その分終了予定時刻を拡大 */
.room-card.running .course-selector-label,
.room-card.warning .course-selector-label,
.room-card.finished .course-selector-label {
  display: none;
}

.room-card.running .room-meta strong,
.room-card.warning .room-meta strong {
  min-height: 52px;
  font-size: clamp(31px, 3.7vw, 47px);
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: 39px;
    font-size: 30px;
  }
}

/* v13.7: 終了予定時刻をさらに大きく強調 */
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong {
  min-height: 60px;
  font-size: clamp(36px, 4.35vw, 56px);
  line-height: 1;
  letter-spacing: .03em;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: 44px;
    font-size: 35px;
    line-height: .95;
  }
}

/* v13.8: iPad 12.9インチ縦表示の余白を活用し、上部帯とコース選択を拡大 */
@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .topbar {
    min-height: 60px;
    padding: 4px 11px;
  }

  .header-clock time {
    font-size: 46px;
    line-height: 1;
  }

  .header-clock span {
    margin-top: 1px;
    font-size: 9px;
  }

  .room-card.idle .course-select {
    min-height: 68px;
    padding: 8px 12px;
    border-width: 2px;
    border-radius: 12px;
    font-size: 26px;
    line-height: 1.1;
    font-weight: 950;
  }

  .room-card.idle .course-select option {
    font-size: 26px;
    font-weight: 900;
  }
}

/* v14.0: 「次に終了」「終了順」を3部屋表示に統一し、文字を大きく見やすくする */
.summary-card .section-title-row h2 {
  font-size: clamp(20px, 2.1vw, 28px);
  font-weight: 950;
}

.summary-list {
  gap: 8px;
}

.summary-list li {
  grid-template-columns: 34px 64px 1fr auto;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  font-size: clamp(14px, 1.35vw, 18px);
}

.summary-list li strong {
  font-size: clamp(22px, 2.25vw, 30px);
  font-weight: 950;
  letter-spacing: .02em;
}

.summary-list li time {
  font-size: clamp(15px, 1.45vw, 20px);
  font-weight: 900;
}

.summary-list .ranking {
  width: 30px;
  height: 30px;
  font-size: 14px;
  font-weight: 950;
}

/* v14.0: 残り時間修正に15〜90分の追加選択を追加 */
.plus-time-input {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #d7deeb;
  color: #5e6a84;
  font-size: 13px;
  font-weight: 800;
}

.plus-time-input > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.plus-time-input select,
.plus-time-input button {
  min-height: 58px;
  border-radius: 11px;
  font-size: 20px;
  font-weight: 900;
}

.plus-time-input select {
  min-width: 0;
  padding: 0 14px;
  color: #10243d;
  border: 2px solid #c8d2e4;
  background: #fff;
}

.plus-time-input button {
  padding: 0 24px;
  color: #041817;
  border: 0;
  background: var(--cyan);
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .summary-card .section-title-row h2 {
    font-size: 17px;
  }

  .summary-list {
    gap: 5px;
  }

  .summary-list li {
    grid-template-columns: 24px 44px 1fr auto;
    gap: 6px;
    min-height: 34px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .summary-list li strong {
    font-size: 18px;
  }

  .summary-list li time {
    font-size: 12px;
  }

  .summary-list .ranking {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
}


/* v14.1: コース未選択時は案内表示、選択後のみスタートを表示 */
.room-card.idle .course-select:invalid {
  color: #8d93a3;
}

.room-card.idle .course-select option {
  color: #1b2233;
}

/* v14.2: 次に終了は黄色、終了順は赤色で区別 */
.next-card .summary-list li {
  border-color: rgba(255, 216, 74, .72);
  background: rgba(255, 216, 74, .12);
  color: #ffe98d;
}

.next-card .summary-list li strong,
.next-card .summary-list li time {
  color: #ffd84a;
}

.next-card .summary-list .ranking {
  background: #ffd84a;
  color: #2b2200;
}

.ended-card .summary-list li {
  border-color: rgba(239, 61, 83, .78);
  background: rgba(239, 61, 83, .14);
  color: #ff9cac;
}

.ended-card .summary-list li strong,
.ended-card .summary-list li time {
  color: #ff5f74;
}

.ended-card .summary-list .ranking {
  background: #ef3d53;
  color: #fff;
}


/* v14.3: 全部屋の高さ固定・未開始時の時間非表示・ヘッダー/PIN位置調整 */
.room-card,
.summary-card {
  height: 274px;
  min-height: 274px;
}

.room-card {
  display: flex;
  flex-direction: column;
}

.room-card .room-actions {
  margin-top: auto;
}

/* コース未開始時は残り時間と終了予定を表示しない */
.room-card.idle .timer-label,
.room-card.idle .timer-display,
.room-card.idle .room-meta {
  display: none;
}

.room-card.idle .course-selector-label {
  margin-top: 14px;
}

/* 上部の帯と現在時刻を拡大 */
.topbar {
  min-height: 98px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.header-clock time {
  font-size: clamp(58px, 7.2vw, 88px);
}

.header-clock span {
  font-size: 12px;
}

/* PIN入力画面だけ画面中央に表示 */
.modal-backdrop.login-active {
  align-items: center;
}

.modal-backdrop.login-active .modal {
  border-radius: 22px;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-card,
  .summary-card {
    height: 255px;
    min-height: 255px;
  }

  .topbar {
    min-height: 84px;
    padding: 7px 11px;
  }

  .header-clock time {
    font-size: 62px;
    line-height: 1;
  }

  .header-clock span {
    margin-top: 2px;
    font-size: 10px;
  }

  .room-card.idle .course-selector-label {
    margin-top: 12px;
  }
}


/* v14.4: 稼働中の表示順調整・中央揃え・ヘッダーボタン2行表示 */
.timer-label,
.timer-display {
  width: 100%;
  text-align: center;
}

.mode-button {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  padding: 5px 10px;
  text-align: center;
  line-height: 1.05;
  white-space: normal;
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .mode-button {
    min-width: 48px;
    padding: 3px 7px;
    line-height: 1.05;
  }
}

.sync-status {
  min-width: 76px;
  padding: 7px 10px;
  border: 1px solid rgba(132, 157, 225, .3);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}
.sync-status.connected { color: #7af1d8; background: rgba(18, 200, 189, .12); }
.sync-status.connecting { color: #ffe27a; background: rgba(255, 216, 74, .12); }
.sync-status.disconnected { color: #ff8f9e; background: rgba(239, 61, 83, .13); }
.operator-disabled .room-card button,
.operator-disabled .room-card select { cursor: not-allowed; }
@media (max-width: 700px) {
  .sync-status { min-width: 58px; padding-inline: 7px; font-size: 9px; }
}


@media (min-width: 1200px) and (orientation: landscape) {
  .room-card,
  .summary-card {
    min-height: 330px;
    height: auto;
  }

  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    overflow: visible;
    padding-bottom: 14px;
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    gap: 10px;
    margin-top: 8px;
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: 62px;
  }

  .room-card .room-actions .reset-button {
    min-height: 36px;
    padding: 7px 10px;
    line-height: 1.2;
  }

  .room-card .course-summary {
    margin: 5px 0 2px;
  }
}
/* コース選択を中央揃え */
.course-select {
  text-align: center;
  text-align-last: center;
}

/* プルダウンの項目も中央揃え（対応ブラウザ） */
.course-select option {
  text-align: center;
}

/* 空室状態：タイマー情報を隠し、コース選択だけを残す */
.room-card.vacant .room-meta,
.room-card.vacant .timer-label,
.room-card.vacant .timer-display,
.room-card.vacant .course-summary {
  display: none !important;
}

.room-card.vacant .course-selector-label {
  margin-top: 14px;
}

.room-card.vacant .status-pill {
  color: #98a4c2;
  background: rgba(255, 255, 255, .055);
}

/* 待機中・空室・各コース名を中央揃え */
.course-select {
  text-align: center;
  text-align-last: center;
}

.course-select option {
  text-align: center;
}
/* 空室・待機中・コースの文字サイズを完全に統一 */
.course-select,
.room-card.vacant .course-select {
  font-size: 32px !important;
  font-weight: 700 !important;
}/* 空室でも待機中と同じ高さ */
.room-card.vacant .course-select{
    height: 64px !important;
    min-height: 64px !important;
    line-height: 64px !important;
}/* 空室だけ控えめな色 */
.room-card.vacant .course-select{
    background: #2b3345 !important;
    border: 1px solid #566179 !important;
    color: #aab5c9 !important;
}

.room-card.vacant{
    background: #1c2437 !important;
}/* 空室・待機中を完全に同じサイズにする */
.room-card.vacant .course-select,
.room-card:not(.vacant) .course-select {
    height: 72px;
    min-height: 72px;
    padding: 0 18px;
    line-height: 72px;
    font-size: 32px;
    font-weight: 700;
    box-sizing: border-box;
}.room-card.vacant .course-select {
    background: #32384d;
    border: 1px solid #5f6983;
    color: #d6d9e3;
}/* 空室・待機中の枠サイズを完全に統一 */
.room-card .course-select {
  display: block !important;
  width: 100% !important;
  height: 72px !important;
  min-height: 72px !important;
  max-height: 72px !important;
  padding: 0 18px !important;
  box-sizing: border-box !important;
  font-size: 32px !important;
  font-weight: 700 !important;
  text-align: center !important;
  text-align-last: center !important;
}

/* 空室だけ控えめな色 */
.room-card.vacant .course-select {
  background: #32384d !important;
  border-color: #5f6983 !important;
  color: #b8c0d0 !important;
}/* 空室の枠を待機中と完全に同じサイズにする */
.room-card.vacant .course-select {
  height: 72px !important;
  min-height: 72px !important;
  max-height: 72px !important;
  padding: 0 18px !important;
  box-sizing: border-box !important;

  background: rgb(50, 56, 77) !important;
  border-color: rgb(95, 105, 131) !important;
  color: rgb(184, 192, 208) !important;
}

/* 全ボタンの押し込みアクション */
button {
  transform: translateY(0) scale(1);
  transition: transform 90ms ease, filter 90ms ease;
  transform-origin: center;
}

button.button-pressed:not(:disabled),
button:active:not(:disabled) {
  transform: translateY(2px) scale(0.96) !important;
  filter: brightness(0.92);
}


/* コース名が見切れないように文字サイズを調整 */
.room-card .course-select,
.room-card.vacant .course-select {
  font-size: 26px !important;
  line-height: normal !important;
  padding-left: 38px !important;
  padding-right: 38px !important;
  white-space: nowrap !important;
}

@media (max-width: 900px) {
  .room-card .course-select,
  .room-card.vacant .course-select {
    font-size: 23px !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
  }
}


.course-selector-label > span,
.room-meta > span {
  display: block;
  width: 100%;
  text-align: center !important;
}

/* 待機中・空室は大きいまま、45分〜990分コースだけ小さく表示 */
.room-card .course-select.numeric-course {
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  padding-left: 30px !important;
  padding-right: 30px !important;
}

.room-card .course-select option[value]:not([value=""]):not([value="vacant"]) {
  font-size: 18px;
}

@media (max-width: 900px) {
  .room-card .course-select.numeric-course {
    font-size: 18px !important;
    padding-left: 26px !important;
    padding-right: 26px !important;
  }
}

.course-select,
.modal select,
.modal input {
  transform: translateY(0) scale(1);
  transition: transform 90ms ease, filter 90ms ease;
  transform-origin: center;
}

.course-select.control-pressed,
.modal select.control-pressed,
.modal input.control-pressed,
.course-select:active,
.modal select:active,
.modal input:active {
  transform: translateY(2px) scale(0.97) !important;
  filter: brightness(0.92);
}


.modal input.control-pressed,
.modal input:active {
  transform: scale(0.995) !important;
  filter: brightness(0.96);
  box-shadow: inset 0 0 0 2px rgba(18, 200, 189, 0.18);
}


.modal input,
.modal input:hover,
.modal input:focus,
.modal input:active,
.modal input.control-pressed {
  transform: none !important;
  translate: none !important;
  scale: 1 !important;
  transition: border-color 90ms ease, box-shadow 90ms ease, background-color 90ms ease !important;
  filter: none !important;
}

/* タップ・フォーカス時は位置を変えず、枠の光だけで反応を示す */
.modal input:focus,
.modal input:active {
  box-shadow: 0 0 0 2px rgba(18, 200, 189, 0.22) !important;
}


/* 「プラスの時間を選択してください」の選択欄は押し込み・移動をしない */
.modal select,
.modal select:hover,
.modal select:focus,
.modal select:active,
.modal select.control-pressed {
  transform: none !important;
  translate: none !important;
  scale: 1 !important;
  transition: border-color 90ms ease, box-shadow 90ms ease, background-color 90ms ease !important;
  filter: none !important;
}

.modal select:focus,
.modal select:active {
  box-shadow: 0 0 0 2px rgba(18, 200, 189, 0.22) !important;
}


.wheel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: end center;
  padding: 20px;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 150ms ease;
}

.wheel-backdrop[hidden] {
  display: none;
}

.wheel-backdrop.visible {
  opacity: 1;
}

.wheel-dialog {
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid rgba(157, 174, 205, 0.28);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(29, 38, 58, 0.99), rgba(15, 22, 37, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  transform: translateY(18px);
  transition: transform 150ms ease;
}

.wheel-backdrop.visible .wheel-dialog {
  transform: translateY(0);
}

.wheel-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(157, 174, 205, 0.16);
}

.wheel-header h2 {
  margin: 0;
  font-size: 21px;
  text-align: center;
}

.wheel-header-button {
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #aebbd1;
  font-size: 17px;
  font-weight: 700;
}

.wheel-header-button:first-child {
  justify-self: start;
}

.wheel-header-button.confirm {
  justify-self: end;
  color: #65e0d2;
}

.wheel-picker-shell {
  position: relative;
  height: 290px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
}

.wheel-picker {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wheel-picker::-webkit-scrollbar {
  display: none;
}

.wheel-spacer {
  height: 116px;
}

.wheel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 58px;
  min-height: 58px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: rgba(218, 226, 240, 0.48);
  font-size: 25px;
  font-weight: 650;
  line-height: 1;
  scroll-snap-align: center;
  transition: color 100ms ease, font-size 100ms ease, opacity 100ms ease;
}

.wheel-item.selected {
  color: #ffffff;
  font-size: 30px;
  opacity: 1;
}

.wheel-selection-frame {
  position: absolute;
  top: 116px;
  right: 18px;
  left: 18px;
  height: 58px;
  pointer-events: none;
  border-top: 1px solid rgba(101, 224, 210, 0.34);
  border-bottom: 1px solid rgba(101, 224, 210, 0.34);
  border-radius: 12px;
  background: rgba(72, 91, 122, 0.17);
}

/* 標準プルダウンの見た目は維持し、操作時だけ自作ホイールを開く */
.course-select,
#plusMinutes {
  cursor: pointer;
}

@media (min-width: 700px) {
  .wheel-backdrop {
    place-items: center;
  }
}


.wheel-dialog {
  width: min(620px, 96vw) !important;
  border-radius: 28px !important;
}

.wheel-header {
  min-height: 88px !important;
  grid-template-columns: 90px 1fr 90px !important;
  padding: 0 14px !important;
}

.wheel-header h2 {
  font-size: 56px !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  line-height: 1 !important;
  color: #ffffff !important;
}

.wheel-picker-shell {
  height: 470px !important;
}

.wheel-spacer {
  height: 206px !important;
}

.wheel-selection-frame {
  top: 206px !important;
  height: 58px !important;
  right: 22px !important;
  left: 22px !important;
  border-radius: 14px !important;
  background: rgba(83, 108, 150, 0.22) !important;
  box-shadow: 0 0 26px rgba(101, 224, 210, 0.08);
}

.wheel-item {
  transform: scale(0.92);
  opacity: 0.54;
  filter: blur(0.15px);
}

.wheel-item.selected {
  transform: scale(1.1) translateZ(0);
  opacity: 1;
  filter: none;
  color: #ffffff !important;
  font-size: 32px !important;
  text-shadow: 0 6px 18px rgba(101, 224, 210, 0.24);
}

.wheel-header-button {
  min-height: 50px !important;
  font-size: 15px !important;
  color: rgba(190, 199, 216, 0.62) !important;
}

.wheel-header-button.confirm {
  position: absolute;
  right: 5%;
  bottom: 22px;
  left: 5%;
  width: 90%;
  min-height: 78px !important;
  border-radius: 20px;
  background: linear-gradient(180deg, #4f8ef7, #2f6edb) !important;
  color: #ffffff !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  box-shadow: 0 12px 28px rgba(47, 110, 219, 0.34);
  z-index: 3;
}

.wheel-dialog {
  position: relative;
  padding-bottom: 120px;
}

#wheelCancelButton {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  margin: auto;
  width: max-content;
  min-height: 34px !important;
  padding: 0 14px !important;
  background: transparent !important;
  color: rgba(190, 199, 216, 0.48) !important;
  font-size: 14px !important;
  z-index: 4;
}

.wheel-picker-shell::before,
.wheel-picker-shell::after {
  content: '';
  position: absolute;
  right: 0;
  left: 0;
  z-index: 2;
  height: 110px;
  pointer-events: none;
}

.wheel-picker-shell::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(20, 28, 44, 0.98), rgba(20, 28, 44, 0));
}

.wheel-picker-shell::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(20, 28, 44, 0.98), rgba(20, 28, 44, 0));
}


.wheel-dialog {
  padding-bottom: 0 !important;
}

.wheel-header {
  grid-template-columns: 1fr !important;
}

.wheel-header-button,
#wheelCancelButton,
#wheelConfirmButton {
  display: none !important;
}

/* 残り時間専用テンキー */
.keypad-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 18, 0.76);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 150ms ease;
}

.keypad-backdrop[hidden] {
  display: none;
}

.keypad-backdrop.visible {
  opacity: 1;
}

.keypad-dialog {
  width: min(480px, 96vw);
  padding: 22px;
  border: 1px solid rgba(157, 174, 205, 0.28);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(29, 38, 58, 0.99), rgba(15, 22, 37, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.keypad-header {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 56px;
}

.keypad-header h2 {
  margin: 0;
  font-size: 23px;
}

.keypad-close-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(126, 139, 164, 0.16);
  color: rgba(226, 232, 242, 0.72);
  font-size: 24px;
}

.keypad-display-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  min-height: 92px;
  margin: 10px 0 18px;
  border: 1px solid rgba(101, 224, 210, 0.28);
  border-radius: 18px;
  background: rgba(48, 64, 91, 0.36);
}

.keypad-display {
  max-width: 80%;
  overflow: hidden;
  color: #ffffff;
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keypad-display-row span {
  color: rgba(220, 228, 240, 0.76);
  font-size: 22px;
  font-weight: 700;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.keypad-grid button {
  min-height: 74px;
  border: 1px solid rgba(151, 166, 194, 0.2);
  border-radius: 18px;
  background: rgba(70, 86, 116, 0.34);
  color: #ffffff;
  font-size: 34px;
  font-weight: 750;
}

.keypad-grid button:active {
  transform: scale(0.96);
  background: rgba(92, 112, 148, 0.48);
}

.keypad-apply-button {
  width: 100%;
  min-height: 72px;
  margin-top: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #4f8ef7, #2f6edb);
  color: #ffffff;
  font-size: 25px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(47, 110, 219, 0.3);
}

#directMinutes[readonly] {
  cursor: pointer;
  caret-color: transparent;
}


.direct-input > div {
  grid-template-columns: minmax(0, 1fr) auto !important;
}

#directMinutes[readonly] {
  width: 100% !important;
  min-height: 68px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
}

/* コース選択は従来の標準プルダウンに戻す */
.course-select {
  pointer-events: auto !important;
  touch-action: manipulation;
}


/* プラス時間はコース選択と同じ標準プルダウン操作にする */
#plusMinutes {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  cursor: pointer !important;
}

/* テンキー上部の設定時間を枠の上下左右中央に配置 */
.keypad-display-row {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 112px !important;
  padding: 0 18px !important;
  line-height: 1 !important;
}

.keypad-display {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 72px !important;
  line-height: 1 !important;
  margin: 0 !important;
}

.keypad-display-row > span {
  display: flex !important;
  align-items: center !important;
  min-height: 72px !important;
  line-height: 1 !important;
  margin: 0 !important;
}

/* 選択済みの「45分コース〜990分コース」を大きく表示 */
.course-select.numeric-course {
  height: 88px !important;
  min-height: 88px !important;
  max-height: 88px !important;
  padding-left: 12px !important;
  padding-right: 34px !important;
  font-size: clamp(36px, 3vw, 42px) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: -0.04em !important;
  text-align: center !important;
  text-align-last: center !important;
}

/* プルダウン内も「コース」の表記を残したまま、可能なブラウザでは大きく表示 */
.course-select option[value]:not([value=""]):not([value="vacant"]) {
  font-size: 36px !important;
  font-weight: 900 !important;
}


/* 各部屋右上の空室・待機中・使用中などの小さな表示を非表示 */
.room-card .status-pill {
  display: none !important;
}

/* 自作コース一覧パネル */
.course-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 18, 0.76);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 150ms ease;
}

.course-panel-backdrop[hidden] {
  display: none;
}

.course-panel-backdrop.visible {
  opacity: 1;
}

.course-panel-dialog {
  width: min(680px, 96vw);
  max-height: min(88vh, 860px);
  overflow: hidden;
  border: 1px solid rgba(157, 174, 205, 0.28);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(29, 38, 58, 0.99), rgba(15, 22, 37, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
  transform: scale(0.98);
  transition: transform 150ms ease;
}

.course-panel-backdrop.visible .course-panel-dialog {
  transform: scale(1);
}

.course-panel-header {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 96px;
  border-bottom: 1px solid rgba(157, 174, 205, 0.16);
}

.course-panel-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}

.course-panel-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(126, 139, 164, 0.14);
  color: rgba(226, 232, 242, 0.62);
  font-size: 26px;
}

.course-panel-list {
  max-height: calc(min(88vh, 860px) - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y proximity;
  padding: 14px;
}

.course-panel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 94px;
  margin: 8px 0;
  padding: 8px 20px;
  border: 1px solid rgba(151, 166, 194, 0.18);
  border-radius: 20px;
  background: rgba(63, 80, 111, 0.28);
  color: #ffffff;
  font-size: clamp(42px, 5.4vw, 66px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.035em;
  scroll-snap-align: center;
}

.course-panel-item.selected {
  border-color: rgba(101, 224, 210, 0.46);
  background: rgba(76, 105, 145, 0.48);
  box-shadow: 0 8px 26px rgba(101, 224, 210, 0.12);
}

.course-panel-item:active {
  transform: scale(0.98);
}

/* 元のselectは見た目を維持しつつ、操作は自作パネルで行う */
.course-select {
  cursor: pointer !important;
}


.course-panel-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1250 !important;
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
  pointer-events: auto;
}

.course-panel-backdrop[hidden] {
  display: none !important;
}

.course-panel-dialog {
  position: fixed !important;
  left: var(--course-panel-left) !important;
  top: var(--course-panel-top) !important;
  width: var(--course-panel-width) !important;
  max-width: calc(100vw - 20px) !important;
  max-height: var(--course-panel-max-height) !important;
  margin-top: 4px !important;
  overflow: hidden !important;
  border-radius: 14px !important;
  transform: none !important;
  background: rgba(19, 28, 47, 0.995) !important;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.52) !important;
}

.course-panel-backdrop.open-above .course-panel-dialog {
  transform: translateY(-100%) !important;
  margin-top: -4px !important;
}

.course-panel-header {
  display: none !important;
}

.course-panel-list {
  max-height: var(--course-panel-max-height) !important;
  padding: 6px !important;
  overflow-y: auto !important;
  scroll-snap-type: y proximity;
}

.course-panel-item {
  min-height: 72px !important;
  margin: 3px 0 !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  font-size: clamp(28px, 3.2vw, 42px) !important;
  letter-spacing: -0.03em !important;
}

.course-panel-item.selected {
  background: rgba(76, 105, 145, 0.52) !important;
  border-color: rgba(101, 224, 210, 0.45) !important;
}

/* プラス時間は+15分から開始 */
#plusMinutes {
  text-align: center !important;
  text-align-last: center !important;
}


.course-panel-dialog {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(48, 52, 61, 0.92), rgba(28, 31, 38, 0.94)) !important;
  -webkit-backdrop-filter: blur(26px) saturate(145%) !important;
  backdrop-filter: blur(26px) saturate(145%) !important;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  overflow: hidden !important;
}

.course-panel-list {
  padding: 6px 8px !important;
  background: transparent !important;
}

.course-panel-item {
  position: relative;
  min-height: 70px !important;
  margin: 0 !important;
  padding: 10px 16px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-size: clamp(28px, 3.1vw, 40px) !important;
  font-weight: 650 !important;
  letter-spacing: -0.025em !important;
  box-shadow: none !important;
  transition:
    background-color 110ms ease,
    transform 110ms ease,
    color 110ms ease !important;
}

/* Apple風の細い区切り線 */
.course-panel-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 1px;
  background: rgba(255, 255, 255, 0.075);
}

/* 現在選択中 */
.course-panel-item.selected {
  background: rgba(10, 132, 255, 0.18) !important;
  color: #ffffff !important;
  font-weight: 720 !important;
  text-shadow: 0 1px 10px rgba(10, 132, 255, 0.18);
}

/* タップ時は深く沈めず、淡く光る */
.course-panel-item:active {
  transform: scale(0.985) !important;
  background: rgba(255, 255, 255, 0.11) !important;
}

/* 上下端を少し柔らかく見せる */
.course-panel-list {
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 18px,
    black calc(100% - 18px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 18px,
    black calc(100% - 18px),
    transparent 100%
  );
}

/* 開く瞬間を少しだけ拡大 */
.course-panel-dialog {
  transform-origin: top center !important;
  animation: appleDropdownIn 140ms cubic-bezier(.2,.8,.2,1);
}

.course-panel-backdrop.open-above .course-panel-dialog {
  transform-origin: bottom center !important;
}

@keyframes appleDropdownIn {
  from {
    opacity: 0;
    transform: scale(0.985) translateY(-2px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 元の待機中・空室・選択済み欄もApple風に少し整える */
.course-select {
  border-color: rgba(255, 255, 255, 0.14) !important;
  background:
    linear-gradient(180deg, rgba(41, 46, 58, 0.86), rgba(29, 33, 43, 0.9)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 6px 18px rgba(0, 0, 0, 0.16) !important;
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  backdrop-filter: blur(16px) saturate(135%);
}

.course-select:focus {
  outline: none !important;
  border-color: rgba(10, 132, 255, 0.72) !important;
  box-shadow:
    0 0 0 3px rgba(10, 132, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}


/* 「コース」の見出しをなくし、表示枠だけにする */
.course-selector-label {
  position: relative !important;
  display: block !important;
  padding-top: 0 !important;
}

/* 実際のselectは操作判定だけに使い、見た目は専用表示へ */
.course-select {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
}

.course-select-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 82px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(41, 46, 58, 0.88), rgba(29, 33, 43, 0.92));
  color: #ffffff;
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 20px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

/* 待機中 */
.course-selector-label.idle-selected .course-select-display {
  background:
    linear-gradient(180deg, rgba(35, 65, 108, 0.88), rgba(24, 45, 79, 0.92));
  border-color: rgba(80, 131, 212, 0.46);
}

/* 空室 */
.course-selector-label.vacant-selected .course-select-display {
  background:
    linear-gradient(180deg, rgba(55, 61, 75, 0.88), rgba(38, 43, 54, 0.94));
  border-color: rgba(128, 139, 160, 0.36);
  color: rgba(230, 235, 244, 0.78);
}

/* コース選択済み：空室と同様に状態が一目で分かる別色 */
.course-selector-label.numeric-selected .course-select-display {
  background:
    linear-gradient(180deg, rgba(25, 105, 98, 0.94), rgba(16, 72, 69, 0.96));
  border-color: rgba(77, 209, 190, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 8px 24px rgba(22, 129, 117, 0.20);
}

/* 待機中・空室 */
.course-state-text {
  font-size: 34px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.01em;
}

/* 「数字」と「分」を最大限大きく、「コース」は小さく */
.course-number {
  font-size: clamp(52px, 5vw, 72px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.course-unit {
  margin-left: 4px;
  font-size: clamp(34px, 3vw, 46px);
  font-weight: 850;
  line-height: 1;
}

.course-word {
  align-self: flex-end;
  margin: 0 0 7px 10px;
  font-size: clamp(15px, 1.25vw, 20px);
  font-weight: 700;
  line-height: 1;
  color: rgba(226, 245, 241, 0.72);
}

/* タップ時は軽く光るだけ */
.course-selector-label:active .course-select-display {
  filter: brightness(1.08);
  transform: scale(0.992);
}


/* スタート後はコース選択表示を出さない。
   これによりリセット・時間修正ボタンの表示領域を確保する。 */
.room-card.running .course-selector-label,
.room-card.warning .course-selector-label,
.room-card.finished .course-selector-label {
  display: none !important;
}

/* スタート後の操作ボタンを確実に表示 */
.room-card.running .room-actions,
.room-card.warning .room-actions,
.room-card.finished .room-actions {
  display: grid !important;
  width: 100% !important;
  margin-top: 10px !important;
  gap: 10px !important;
  overflow: visible !important;
}

.room-card.running .reset-button,
.room-card.warning .reset-button,
.room-card.finished .reset-button {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  width: 100% !important;
  min-height: 58px !important;
}

/* コース選択済みの色を深いグリーンから落ち着いた紫紺へ変更 */
.course-selector-label.numeric-selected .course-select-display {
  background:
    linear-gradient(180deg, rgba(74, 72, 120, 0.94), rgba(48, 47, 88, 0.96)) !important;
  border-color: rgba(145, 139, 224, 0.52) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 8px 24px rgba(91, 82, 170, 0.18) !important;
}

.course-selector-label.numeric-selected .course-word {
  color: rgba(235, 232, 255, 0.74) !important;
}

/* iPad縦でカード内部がはみ出さないように調整 */
@media (max-width: 1199px) {
  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    overflow: visible !important;
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    margin-top: 6px !important;
  }

  .room-card.running .reset-button,
  .room-card.warning .reset-button,
  .room-card.finished .reset-button {
    min-height: 54px !important;
  }
}


/* コース選択済みは、待機中より少し明るい青 */
.course-selector-label.numeric-selected .course-select-display {
  background:
    linear-gradient(180deg, rgba(49, 104, 178, 0.96), rgba(32, 74, 132, 0.98)) !important;
  border-color: rgba(103, 166, 255, 0.68) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 24px rgba(37, 102, 190, 0.22) !important;
}

.course-selector-label.numeric-selected .course-word {
  color: rgba(230, 241, 255, 0.76) !important;
}

/* スタート後はコース選択欄を完全に非表示 */
.room-card.running .course-selector-label,
.room-card.warning .course-selector-label,
.room-card.finished .course-selector-label {
  display: none !important;
}

/* スタート後の情報を縦に整理し、終了予定と残り時間の重なりを防ぐ */
.room-card.running,
.room-card.warning,
.room-card.finished {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.room-card.running .room-meta,
.room-card.warning .room-meta,
.room-card.finished .room-meta {
  position: static !important;
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  margin: 0 0 6px !important;
  padding: 0 !important;
  min-height: 54px !important;
  text-align: center !important;
}

.room-card.running .room-meta span,
.room-card.warning .room-meta span,
.room-card.finished .room-meta span {
  display: block !important;
  margin: 0 0 2px !important;
  line-height: 1.1 !important;
}

.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  display: block !important;
  position: static !important;
  line-height: 1 !important;
  margin: 0 !important;
}

.room-card.running .timer-label,
.room-card.warning .timer-label,
.room-card.finished .timer-label {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 4px 0 2px !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 1.15 !important;
}

.room-card.running .timer-display,
.room-card.warning .timer-display,
.room-card.finished .timer-display {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 1 !important;
}

/* 通常時の残り時間は緑系をやめて、見やすい白青へ */
.room-card.running .timer-display {
  color: #d8eaff !important;
  text-shadow: 0 0 18px rgba(84, 157, 255, 0.16) !important;
}

/* 15秒前の警告色と終了時の赤は既存の意味を維持 */
.room-card.warning .timer-display {
  color: #ffd75e !important;
}

.room-card.finished .timer-display {
  color: #ff6b78 !important;
}

/* コース要約（45分）は従来通り残し、場所を固定 */
.room-card.running .course-summary,
.room-card.warning .course-summary,
.room-card.finished .course-summary {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 4px 0 0 !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 1.1 !important;
}

/* 操作ボタンをカード下部に確実に表示 */
.room-card.running .room-actions,
.room-card.warning .room-actions,
.room-card.finished .room-actions {
  position: static !important;
  display: grid !important;
  width: 100% !important;
  margin-top: auto !important;
  padding-top: 8px !important;
  gap: 8px !important;
  overflow: visible !important;
}

.room-card.running .adjust-button,
.room-card.warning .adjust-button,
.room-card.running .reset-button,
.room-card.warning .reset-button,
.room-card.finished .reset-button {
  position: static !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  min-height: 48px !important;
  margin: 0 !important;
}

/* iPad縦向け：文字と余白を詰めすぎず、ボタンまで収める */
@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1000px) and (orientation: portrait) {
  .room-card.running .room-meta,
  .room-card.warning .room-meta,
  .room-card.finished .room-meta {
    min-height: 44px !important;
    margin-bottom: 3px !important;
  }

  .room-card.running .timer-label,
  .room-card.warning .timer-label,
  .room-card.finished .timer-label {
    margin: 2px 0 1px !important;
  }

  .room-card.running .course-summary,
  .room-card.warning .course-summary,
  .room-card.finished .course-summary {
    margin-top: 2px !important;
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    padding-top: 5px !important;
    gap: 5px !important;
  }

  .room-card.running .adjust-button,
  .room-card.warning .adjust-button,
  .room-card.running .reset-button,
  .room-card.warning .reset-button,
  .room-card.finished .reset-button {
    min-height: 42px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
}


/* スタートボタンを上品な黄色へ */
.start-button {
  background:
    linear-gradient(180deg, #ffd95a 0%, #e7aa1d 100%) !important;
  border-color: rgba(255, 226, 112, 0.72) !important;
  color: #201706 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.24) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 9px 22px rgba(207, 147, 17, 0.28) !important;
}

.start-button:active,
.start-button.button-pressed {
  filter: brightness(1.08) !important;
}

/* 終了予定の時間枠を横に広げる */
.room-card.running .room-meta,
.room-card.warning .room-meta,
.room-card.finished .room-meta {
  width: min(94%, 430px) !important;
  align-self: center !important;
  padding-left: 18px !important;
  padding-right: 18px !important;
  box-sizing: border-box !important;
}

.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  width: 100% !important;
  min-width: 0 !important;
  text-align: center !important;
}

/* 残り15秒：背景に同化しない高コントラスト表示 */
.room-card.warning .timer-display {
  color: #fff4c2 !important;
  -webkit-text-stroke: 1px rgba(65, 34, 0, 0.72);
  text-shadow:
    0 2px 0 rgba(62, 33, 0, 0.82),
    0 0 12px rgba(255, 161, 24, 0.96),
    0 0 28px rgba(255, 118, 0, 0.58) !important;
  filter: brightness(1.18) saturate(1.12);
}

/* 終了時は赤く、ゆっくり点滅 */
.room-card.finished .timer-display,
.room-card.finished .room-meta strong {
  color: #ff6b78 !important;
  animation: finishedAttentionPulse 0.8s ease-in-out infinite alternate;
}

@keyframes finishedAttentionPulse {
  from {
    opacity: 0.68;
    text-shadow: 0 0 8px rgba(255, 56, 80, 0.28);
  }
  to {
    opacity: 1;
    text-shadow:
      0 0 12px rgba(255, 56, 80, 0.72),
      0 0 24px rgba(255, 56, 80, 0.34);
  }
}

/* コース一覧は慣性を維持しつつ速く動かす */
.course-panel-list {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scroll-behavior: auto !important;
}


/* 終了予定の数字を枠の上下左右中央へ */
.room-card.running .room-meta,
.room-card.warning .room-meta,
.room-card.finished .room-meta {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 68px !important;
  padding-top: 7px !important;
  padding-bottom: 7px !important;
  box-sizing: border-box !important;
}

.room-card.running .room-meta span,
.room-card.warning .room-meta span,
.room-card.finished .room-meta span {
  flex: 0 0 auto !important;
  margin: 0 0 3px !important;
  line-height: 1 !important;
}

.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
}

/* スタートボタンを、コース選択済みと同じ明るい青へ */
.start-button {
  background:
    linear-gradient(180deg, rgba(49, 104, 178, 0.98), rgba(32, 74, 132, 1)) !important;
  border-color: rgba(103, 166, 255, 0.72) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 9px 24px rgba(37, 102, 190, 0.28) !important;
}

.start-button:active,
.start-button.button-pressed {
  filter: brightness(1.10) !important;
}

/* Safari本来の自然なスクロールへ戻す。
   止めれば止まり、勢いよく払えば慣性で進む。 */
.course-panel-list {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scroll-behavior: auto !important;
}


/* 残り15秒は赤文字で明確に表示 */
.room-card.warning .timer-display {
  color: #ff4d5e !important;
  -webkit-text-stroke: 0 !important;
  text-shadow:
    0 0 10px rgba(255, 42, 67, 0.88),
    0 0 24px rgba(255, 42, 67, 0.38) !important;
  filter: none !important;
}

/* コース選択済みの枠を、待機中より明るい青へ */
.course-selector-label.numeric-selected .course-select-display {
  background:
    linear-gradient(180deg, #4287e8 0%, #2f6fc9 100%) !important;
  border-color: rgba(136, 190, 255, 0.86) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    0 9px 24px rgba(47, 111, 201, 0.30) !important;
}

.course-selector-label.numeric-selected .course-number,
.course-selector-label.numeric-selected .course-unit {
  color: #ffffff !important;
}

.course-selector-label.numeric-selected .course-word {
  color: rgba(235, 245, 255, 0.82) !important;
}

/* 慣性スクロールの土台はSafariの自然な縦操作を維持 */
.course-panel-list {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scroll-behavior: auto !important;
}


.room-card.warning .timer-display {
  color: #FFD54A !important;
  -webkit-text-stroke: 0 !important;
  text-shadow:
    0 2px 0 rgba(76, 49, 0, 0.82),
    0 0 10px rgba(255, 213, 74, 0.90),
    0 0 24px rgba(255, 170, 0, 0.42) !important;
  filter: brightness(1.08) saturate(1.05) !important;
}


/* 通常時の残り時間を以前のグリーン系へ戻す */
.room-card.running .timer-display {
  color: #58e6c4 !important;
  text-shadow:
    0 0 10px rgba(55, 220, 186, 0.30),
    0 0 20px rgba(55, 220, 186, 0.12) !important;
  filter: none !important;
}

/* 残り15秒は黒系で、明るい警告背景の上でも読みやすくする */
.room-card.warning .timer-display {
  color: #111318 !important;
  -webkit-text-stroke: 0 !important;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 2px rgba(255, 255, 255, 0.18) !important;
  filter: none !important;
  font-weight: 950 !important;
}

/* 指に追従する自然な縦スクロールを維持 */
.course-panel-list {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scroll-behavior: auto !important;
}


/* 通常時の残り時間から光彩を削除 */
.room-card.running .timer-display{
  text-shadow:none !important;
  filter:none !important;
}

/* リセットボタンの上下余白を狭く */
.reset-button{
  padding-top:6px !important;
  padding-bottom:6px !important;
  min-height:42px !important;
}

/* 「残り時間を修正する」ボタンを少し大きく */
.adjust-button{
  padding-top:14px !important;
  padding-bottom:14px !important;
  min-height:60px !important;
}


/* 終了予定の時間から光彩を完全に削除 */
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  text-shadow: none !important;
  filter: none !important;
}

/* スタート後：
   「残り時間を修正する」は縦に広く、
   「リセット」は縦に狭くして、枠の高さを明確に変える */
.room-card.running .adjust-button,
.room-card.warning .adjust-button {
  height: 68px !important;
  min-height: 68px !important;
  max-height: 68px !important;
  padding: 14px 12px !important;
  box-sizing: border-box !important;
  font-size: 20px !important;
  line-height: 1.15 !important;
}

.room-card.running .reset-button,
.room-card.warning .reset-button {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 3px 12px !important;
  box-sizing: border-box !important;
  font-size: 18px !important;
  line-height: 1 !important;
  color: #ff5364 !important;
}

/* 終了後のアラーム停止ボタンは従来の大きさを維持。
   アラーム停止後に表示されるリセットだけ赤文字・小さめにする */
.room-card.finished .reset-button:not(.alarm-stop-button) {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 3px 12px !important;
  box-sizing: border-box !important;
  font-size: 18px !important;
  line-height: 1 !important;
  color: #ff5364 !important;
}

.room-card.finished .reset-button.alarm-stop-button {
  color: inherit !important;
}

/* iPad縦でも上記の高さを優先 */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .room-card.running .adjust-button,
  .room-card.warning .adjust-button {
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
  }

  .room-card.running .reset-button,
  .room-card.warning .reset-button,
  .room-card.finished .reset-button:not(.alarm-stop-button) {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
  }
}


/* 終了予定の数字は全状態で光彩・点滅を完全に解除 */
.room-card .room-meta strong,
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  text-shadow: none !important;
  filter: none !important;
  animation: none !important;
  opacity: 1 !important;
}

/* ボタン領域をカード内に確実に収める */
.room-card.running .room-actions,
.room-card.warning .room-actions,
.room-card.finished .room-actions {
  display: grid !important;
  grid-template-rows: auto auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  margin-top: auto !important;
  padding-top: 4px !important;
  padding-bottom: 0 !important;
  gap: 4px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

/* 「残り時間を修正する」は大きく */
.room-card.running .adjust-button,
.room-card.warning .adjust-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  margin: 0 !important;
  padding: 10px 8px !important;
  box-sizing: border-box !important;
  font-size: 19px !important;
  line-height: 1.1 !important;
}

/* 「リセット」は上下を狭くし、文字全体が見える高さを確保 */
.room-card.running .reset-button,
.room-card.warning .reset-button,
.room-card.finished .reset-button:not(.alarm-stop-button) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  margin: 0 !important;
  padding: 1px 8px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  white-space: nowrap !important;
  font-size: 17px !important;
  line-height: 1 !important;
  color: #ff5364 !important;
}

/* 終了時のアラーム停止は従来の大きさを維持 */
.room-card.finished .reset-button.alarm-stop-button {
  height: auto !important;
  min-height: 54px !important;
  max-height: none !important;
  padding: 8px !important;
  color: inherit !important;
}

/* iPad縦向けでも見切れないよう、カード下端に余白を確保 */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    padding-bottom: 6px !important;
  }

  .room-card.running .adjust-button,
  .room-card.warning .adjust-button {
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
  }

  .room-card.running .reset-button,
  .room-card.warning .reset-button,
  .room-card.finished .reset-button:not(.alarm-stop-button) {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    font-size: 16px !important;
  }
}


.room-card .room-meta strong,
.room-card.idle .room-meta strong,
.room-card.vacant .room-meta strong,
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong {
  color: inherit !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 transparent !important;
  filter: none !important;
  animation: none !important;
  box-shadow: none !important;
  background: transparent !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

/* 終了状態で親要素から継承する発光も解除 */
.room-card.finished .room-meta,
.room-card.warning .room-meta,
.room-card.running .room-meta {
  filter: none !important;
  text-shadow: none !important;
  animation: none !important;
}

/* 終了時の点滅ルールが時刻へ適用されないよう明示 */
.room-card.finished .room-meta strong {
  animation-name: none !important;
  text-shadow: none !important;
}


/* 終了予定時刻：元のグリーン系へ戻す（光彩なし） */
.room-card .room-meta strong,
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong{
  color:#58e6c4 !important;
  text-shadow:none !important;
  -webkit-text-stroke:0 !important;
  filter:none !important;
  animation:none !important;
}

/* 終了予定時刻：オレンジへ戻す（光彩なし） */
.room-card .room-meta strong,
.room-card.running .room-meta strong,
.room-card.warning .room-meta strong,
.room-card.finished .room-meta strong{
  color:#F5A623 !important;
  text-shadow:none !important;
  -webkit-text-stroke:0 !important;
  filter:none !important;
  animation:none !important;
}


/* 自作コース一覧は、押した待機中枠と完全に同じ横幅 */
.course-panel-dialog {
  width: var(--course-panel-width) !important;
  min-width: 0 !important;
  max-width: var(--course-panel-width) !important;
  box-sizing: border-box !important;
}

.course-panel-list,
.course-panel-item {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* iPhone/Safari本来の慣性スクロールを使用。
   指を止めれば止まり、素早く払えば自然に慣性で進む。 */
.course-panel-list {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scroll-behavior: auto !important;
}

/* コース選択のすぐ下までスタートボタンを広げる */
.room-card.idle .room-actions {
  margin-top: 6px !important;
  padding-top: 0 !important;
}

.room-card.idle .start-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  text-align: center !important;
}

/* iPad縦でも文字を中央に保ち、高さを確保 */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .room-card.idle .room-actions {
    margin-top: 4px !important;
  }

  .room-card.idle .start-button {
    height: 86px !important;
    min-height: 86px !important;
    max-height: 86px !important;
  }
}


/* 待機中・空室ではスタートボタンを表示しない */
.room-card.idle .start-button[hidden],
.room-card.vacant .start-button,
.room-card.vacant .room-actions {
  display: none !important;
}

/* 待機中でコース未選択のときも非表示 */
.room-card.idle .course-selector-label.idle-selected + .room-actions .start-button {
  display: none !important;
}

/* コース選択済みのときだけスタートを表示 */
.room-card.idle .course-selector-label.numeric-selected + .room-actions .start-button:not([hidden]) {
  display: flex !important;
}


/* 最終デザイン調整 */

/* コース選択済みと同じ明るい青 */
.room-card.idle .start-button{
  background:linear-gradient(180deg,#4287e8 0%,#2f6fc9 100%) !important;
  border:1px solid rgba(136,190,255,.9) !important;
  color:#fff !important;
}

/* スタート文字を大きく */
.room-card.idle .start-button{
  font-size:30px !important;
  font-weight:800 !important;
  letter-spacing:.04em;
}

/* コース選択後（スタート待ち）のカード背景を少し明るく */
.room-card.idle:has(.course-selector-label.numeric-selected){
  background:linear-gradient(180deg,#3d4d67 0%,#324258 100%) !important;
}


.room-card.idle .start-button {
  font-size: 34px !important;
  font-weight: 850 !important;
  letter-spacing: 0.035em !important;
  background:
    linear-gradient(
      180deg,
      #5a9af0 0%,
      #4287e8 12%,
      #2f6fc9 100%
    ) !important;
  border: 1px solid rgba(151, 201, 255, 0.90) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.20) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 8px 18px rgba(27, 79, 153, 0.26) !important;
}

.room-card.idle .start-button:active,
.room-card.idle .start-button.button-pressed {
  transform: translateY(1px) scale(0.992) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    0 4px 10px rgba(27, 79, 153, 0.20) !important;
  filter: brightness(0.98) !important;
}

/* プラス時間もコース選択と同じ自作一覧パネルで操作 */
#plusMinutes {
  cursor: pointer !important;
  touch-action: manipulation !important;
}

/* プラス時間の一覧は文字を少し大きくして見やすく */
.course-panel-item[data-course-panel-value="15"],
.course-panel-item[data-course-panel-value="30"],
.course-panel-item[data-course-panel-value="45"],
.course-panel-item[data-course-panel-value="60"],
.course-panel-item[data-course-panel-value="75"],
.course-panel-item[data-course-panel-value="90"] {
  font-weight: 800 !important;
}


/* 残り15秒のとき、終了予定の時刻だけ赤色に変更。
   光彩・影・点滅は付けない。 */
.room-card.warning .room-meta strong {
  color: #ff5364 !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  filter: none !important;
  animation: none !important;
}

/* アラーム停止後に表示されるリセットを大きく・横いっぱいにする */
.room-card.finished.alarm-silenced .room-actions {
  display: block !important;
  width: 100% !important;
  margin-top: auto !important;
  padding-top: 8px !important;
}

.room-card.finished.alarm-silenced .reset-button:not(.alarm-stop-button) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 68px !important;
  min-height: 68px !important;
  max-height: 68px !important;
  margin: 0 !important;
  padding: 10px 16px !important;
  box-sizing: border-box !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  color: #ff5364 !important;
  white-space: nowrap !important;
}

/* iPad縦でも十分な大きさを維持 */
@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .room-card.finished.alarm-silenced .reset-button:not(.alarm-stop-button) {
    height: 62px !important;
    min-height: 62px !important;
    max-height: 62px !important;
    font-size: 22px !important;
  }
}


/* コース選択後・スタート前のリセットボタン */
.room-card.idle .prestart-reset-button[hidden],
.room-card.vacant .prestart-reset-button {
  display: none !important;
}

.room-card.idle .course-selector-label.numeric-selected + .room-actions .prestart-reset-button:not([hidden]) {
  display: flex !important;
}

.room-card.idle .prestart-reset-button {
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  margin: 6px 0 0 !important;
  padding: 4px 12px !important;
  box-sizing: border-box !important;
  color: #ff5364 !important;
  font-size: 18px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
}


/* スタート前リセットを少し低くして見切れ防止 */
.room-card.idle .prestart-reset-button{
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  margin-top:4px !important;
  padding:2px 10px !important;
  font-size:17px !important;
  line-height:1 !important;
}

@media (min-width:901px) and (max-width:1100px) and (orientation:portrait){
  .room-card.idle .prestart-reset-button{
    height:32px !important;
    min-height:32px !important;
    max-height:32px !important;
    margin-top:3px !important;
    font-size:16px !important;
  }
}


/* v1.0 iPad単体運用 */
.sync-status.connected {
  color: rgba(255, 255, 255, 0.72) !important;
}

.pin-error:empty {
  display: none !important;
}


/* v1.0 プルダウン安定化 */

/* Safari標準selectは内部の値保持だけに使い、画面には出さない */
.course-selector-label,
.plus-time-input > div {
  position: relative !important;
}

.course-select,
#plusMinutes {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  pointer-events: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  color: transparent !important;
}

/* 自作表示を常に前面に固定 */
.course-select-display {
  position: relative !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

/* 401・403・405は必ず上方向へ開く */
.room-card[data-room="401"] .course-selector-label,
.room-card[data-room="403"] .course-selector-label,
.room-card[data-room="405"] .course-selector-label {
  touch-action: manipulation !important;
}


/* v1.0 プルダウン完全安定化 */

/* Safari標準selectをDOM内の値保持専用にする */
.course-select,
#plusMinutes {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 自作トリガー部分 */
.course-selector-label {
  display: block !important;
  cursor: pointer !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  touch-action: manipulation !important;
}

.plus-time-label {
  display: block;
}

/* 上下位置をtransformに頼らず固定 */
.course-panel-dialog {
  left: var(--course-panel-left) !important;
  top: var(--course-panel-top) !important;
  bottom: var(--course-panel-bottom) !important;
  margin: 0 !important;
  transform: none !important;
  animation: none !important;
  transition: opacity 90ms ease !important;
}

.course-panel-backdrop.open-above .course-panel-dialog {
  top: auto !important;
  bottom: var(--course-panel-bottom) !important;
  margin: 0 !important;
  transform: none !important;
  animation: none !important;
}

.course-panel-backdrop:not(.open-above) .course-panel-dialog {
  top: var(--course-panel-top) !important;
  bottom: auto !important;
}

/* 表示前の一瞬の誤位置を防止 */
.course-panel-backdrop:not(.visible) .course-panel-dialog {
  opacity: 0 !important;
}

.course-panel-backdrop.visible .course-panel-dialog {
  opacity: 1 !important;
}


/* 安定版：PC/iPad共通の確実なボタン操作 */
.course-select-trigger {
  display: block !important;
  width: 100% !important;
  min-height: 72px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: inherit !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.course-select-trigger .course-select-display {
  width: 100% !important;
  min-height: 72px !important;
  pointer-events: none !important;
}

/* プラス時間：白背景・黒文字 */
#plusMinutesTrigger.plus-minutes-display {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 72px !important;
  padding: 0 18px !important;
  border: 1px solid #cfd5df !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #111111 !important;
  font-size: 32px !important;
  font-weight: 800 !important;
  text-shadow: none !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* スクロールはSafari/iPad本来の滑らかな慣性へ戻す */
.course-panel-list {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: auto !important;
  overscroll-behavior-y: contain !important;
}

/* コース選択(45分〜990分)は選択をタップで行うため、
   スクロールの吸着(scroll-snap)は無効化し、
   iPhone標準アプリのような減速の長い自然な慣性スクロールにする。
   ※ +分の数字ホイール(.wheel-item)はスクロール位置そのものが選択値になる
     ため対象外(吸着を外すと選択がずれて見える)。 */
.course-panel-list {
  scroll-snap-type: none !important;
}
.course-panel-item {
  scroll-snap-align: none !important;
}


/* 秘書と社長：店舗専用レイアウト */
.room-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(292px, auto);
  padding-left: 60px;
  align-items: stretch;
}

.room-card,
.summary-card {
  min-height: 292px;
  height: 100%;
}

.room-title-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.room-reading {
  color: #8f9ab9;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.warning .room-reading,
.finished .room-reading {
  color: currentColor;
  opacity: .74;
}

.floor-grid-2 .room-position-2-3 {
  grid-column: 1;
}

.summary-card {
  overflow: hidden;
}

.summary-list {
  max-height: 225px;
  overflow: auto;
  padding-right: 2px;
}

@media (max-width: 900px) {
  .room-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-left: 0;
  }
}

@media (max-width: 700px) {
  .room-grid,
  .room-grid-two {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .room-card,
  .summary-card {
    min-height: 270px;
  }
  .room-title-block {
    gap: 4px;
  }
  .room-reading {
    font-size: 8px;
  }
}

@media (min-width: 901px) and (max-width: 1100px) and (min-height: 1200px) and (orientation: portrait) {
  .room-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(252px, 1fr);
  }
  .room-card,
  .summary-card {
    min-height: 0;
    height: 100%;
  }
  .summary-list {
    max-height: 180px;
  }
}


/* v1.0.1: 稼働中の「残り時間を修正する」「リセット」を同じ行に確実に表示 */
.room-card.running,
.room-card.warning,
.room-card.finished {
  overflow: visible !important;
}

.room-card.running .room-actions,
.room-card.warning .room-actions {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) !important;
  align-items: stretch !important;
}

.room-card.running .room-actions .adjust-button,
.room-card.warning .room-actions .adjust-button,
.room-card.running .room-actions .reset-button,
.room-card.warning .room-actions .reset-button {
  display: block !important;
  visibility: visible !important;
  min-height: 58px !important;
  margin: 0 !important;
}

.room-card.finished .room-actions {
  grid-template-columns: 1fr !important;
}

/* 読み仮名は音声読み上げ専用。画面には表示しない */
.room-reading {
  display: none !important;
}


/* v1.0.2: 操作ボタンはカード幅いっぱい・同じ横幅で縦並び */
.room-card.running .room-actions,
.room-card.warning .room-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
  gap: 8px !important;
}

.room-card.running .room-actions .adjust-button,
.room-card.warning .room-actions .adjust-button,
.room-card.running .room-actions .reset-button,
.room-card.warning .room-actions .reset-button {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 58px !important;
  margin: 0 !important;
}


/* 秘書と社長版：右上はログアウトのみ・1行表示 */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.header-actions .sync-status,
.header-actions #modeButton {
  display: none !important;
}
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  min-height: 42px;
  padding: 0 18px;
  white-space: nowrap;
  line-height: 1;
}
.logout-button[hidden] {
  display: none !important;
}

/* PC 3x3 layout: 7-8-9 / 4-5-6 / 1-2-3 */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body::before { content: none !important; }

  .app-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
    min-height: 650px;
    padding: 8px 10px 7px;
    overflow: hidden;
  }

  .topbar {
    min-height: 70px;
    padding-block: 5px;
  }

  .header-clock time { font-size: clamp(42px, 4vw, 62px); }
  main { min-height: 0; margin-top: 8px; }
  .rooms-container { height: 100%; min-height: 0; }

  .pc-timer-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
    gap: 9px;
    height: 100%;
    min-height: 0;
  }

  .pc-room-area,
  .pc-summary-area { min-width: 0; min-height: 0; }

  .pc-room-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 8px;
    height: 100%;
  }

  .pc-summary-area {
    display: grid;
    grid-template-rows: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 8px;
  }

  .room-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 9px 10px;
  }

  .room-card h3 { font-size: clamp(25px, 2vw, 34px); }
  .room-meta { min-height: 41px; }
  .room-meta strong { min-height: 31px; font-size: clamp(20px, 1.8vw, 29px); }
  .timer-label { margin-top: 5px; }
  .timer-display { margin: 2px 0 4px; font-size: clamp(26px, 2.4vw, 39px); }
  .course-selector-label { margin-top: auto; padding: 4px 0 4px; }
  .course-select-trigger { min-height: 36px !important; }
  .course-select-display { min-height: 36px !important; }

  .room-actions {
    grid-template-columns: 1fr !important;
    gap: 4px;
  }

  .room-actions button {
    min-height: 31px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .room-actions .reset-button,
  .room-actions .adjust-button {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .summary-card {
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  .summary-list {
    align-content: start;
    max-height: calc(100% - 42px);
    overflow: auto;
  }

  .summary-list li {
    grid-template-columns: 23px 43px minmax(0, 1fr) auto;
    min-height: 36px;
    font-size: 12px;
  }

  footer { margin-top: 5px; }
}

@media (min-width: 901px) and (max-height: 800px) {
  .app-shell { min-height: 600px; }
  .topbar { min-height: 60px; }
  .eyebrow { margin-bottom: 3px; }
  .header-clock time { font-size: 42px; }
  .room-card { padding: 7px 8px; }
  .room-card h3 { font-size: 25px; }
  .room-meta { min-height: 35px; }
  .room-meta strong { min-height: 27px; font-size: 21px; }
  .timer-display { font-size: 28px; }
  .course-select-trigger,
  .course-select-display { min-height: 31px !important; }
  .room-actions button { min-height: 27px; font-size: 10px; }
  footer { display: none; }
}

/* PC v1.1: 部屋カード拡大・操作ボタンの横幅統一と縦幅調整 */
@media (min-width: 901px) {
  .pc-timer-layout {
    grid-template-columns: minmax(0, 3.35fr) minmax(270px, .95fr);
    gap: 10px;
  }

  .pc-room-grid {
    gap: 10px;
  }

  .room-card {
    padding: clamp(9px, 1vh, 13px) clamp(10px, .9vw, 15px);
  }

  /* コース枠・各操作ボタンは部屋カードの横幅いっぱいに統一 */
  .course-selector-label,
  .course-select-trigger,
  .course-select-display,
  .room-actions,
  .room-actions button {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* コース選択：スタートに次いで大きく */
  .course-select-trigger,
  .course-select-display {
    min-height: clamp(58px, 7.2vh, 95px) !important;
    border-radius: 11px;
  }

  .course-select-display {
    font-size: clamp(17px, 1.35vw, 23px);
    font-weight: 950;
  }

  .room-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: clamp(5px, .65vh, 9px) !important;
  }

  /* スタート：最も大きい */
  .room-actions .start-button {
    min-height: clamp(64px, 7.8vh, 100px) !important;
    padding: 8px 12px !important;
    border-radius: 11px;
    font-size: clamp(17px, 1.4vw, 24px) !important;
  }

  /* 残り時間修正・アラーム停止：中サイズ */
  .room-actions .adjust-button,
  .room-actions .alarm-stop-button,
  .room-actions.single-action .alarm-stop-button {
    min-height: clamp(56px, 6.7vh, 85px) !important;
    padding: 7px 10px !important;
    border-radius: 10px;
    font-size: clamp(14px, 1.15vw, 20px) !important;
  }

  /* リセット：横幅は同じ、縦幅は最小 */
  .room-actions .reset-button,
  .room-actions .prestart-reset-button,
  .room-actions.single-action .reset-button {
    min-height: clamp(38px, 4.3vh, 55px) !important;
    padding: 5px 10px !important;
    border-radius: 9px;
    font-size: clamp(12px, .95vw, 17px) !important;
  }
}

/* 高さが低いPCでも3×3を崩さず収める */
@media (min-width: 901px) and (max-height: 800px) {
  .pc-timer-layout {
    grid-template-columns: minmax(0, 3.2fr) minmax(255px, .9fr);
  }

  .pc-room-grid { gap: 7px; }

  .course-select-trigger,
  .course-select-display {
    min-height: 48px !important;
  }

  .room-actions .start-button {
    min-height: 52px !important;
  }

  .room-actions .adjust-button,
  .room-actions .alarm-stop-button,
  .room-actions.single-action .alarm-stop-button {
    min-height: 45px !important;
  }

  .room-actions .reset-button,
  .room-actions .prestart-reset-button,
  .room-actions.single-action .reset-button {
    min-height: 33px !important;
  }
}

/* PC TEST 1.2: 画面全体を使い、各部屋カード内の操作枠を縦方向いっぱいに拡大 */
@media (min-width: 901px) {
  .app-shell {
    grid-template-rows: 64px minmax(0, 1fr) 16px;
    min-height: 560px;
    padding: 4px 5px 3px;
  }

  .topbar {
    min-height: 64px;
    padding: 4px 10px;
    border-radius: 10px;
  }

  .eyebrow { margin-bottom: 2px; }
  .topbar h1 { font-size: clamp(15px, 1.45vw, 23px); }
  .header-clock time { font-size: clamp(39px, 3.7vw, 59px); }
  .header-clock span { margin-top: 1px; font-size: 10px; }
  .logout-button { min-width: 92px; min-height: 36px; padding-inline: 14px; }

  main { margin-top: 5px; }

  .pc-timer-layout {
    grid-template-columns: minmax(0, 3.45fr) minmax(285px, 1fr);
    gap: 5px;
  }

  .pc-room-grid { gap: 5px; }
  .pc-summary-area { gap: 5px; }

  .room-card {
    height: auto;
    min-height: 0;
    padding: 7px 9px 8px;
    border-radius: 8px;
  }

  .room-card-top { flex: 0 0 auto; }
  .room-card h3 { font-size: clamp(25px, 1.8vw, 34px); }
  .status-pill { display: none; }

  /* 待機中カード：待機中の枠を空きスペースいっぱいにする */
  .room-card.idle .course-selector-label {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    margin: 8px 0 0;
    padding: 0;
  }

  .room-card.idle .course-select-trigger,
  .room-card.idle .course-select-display {
    height: 100%;
    min-height: 0 !important;
  }

  .room-card.idle .course-select-trigger {
    display: flex;
    flex: 1 1 auto;
    padding: 0;
    border-radius: 10px;
  }

  .room-card.idle .course-select-display {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    font-size: clamp(27px, 2.15vw, 42px);
    line-height: 1;
  }

  /* コース選択後：コース・スタートを大きく、リセットは小さく */
  .room-card.idle:has(.start-button:not([hidden])) .course-selector-label {
    flex: 0 1 34%;
    min-height: 0;
    margin-top: 8px;
  }

  .room-card.idle:has(.start-button:not([hidden])) .course-select-display {
    font-size: clamp(25px, 2.1vw, 40px);
  }

  .room-card.idle .room-actions {
    flex: 0 0 auto;
    gap: 7px !important;
    margin-top: 7px;
  }

  .room-card.idle .room-actions .start-button {
    min-height: clamp(54px, 7.3vh, 94px) !important;
    font-size: clamp(24px, 2vw, 38px) !important;
  }

  .room-card.idle .room-actions .prestart-reset-button {
    min-height: clamp(30px, 3.8vh, 48px) !important;
    font-size: clamp(13px, 1vw, 18px) !important;
  }

  /* 稼働中：情報と操作をカード内で均等に広げる */
  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    justify-content: flex-start;
  }

  .room-card.running .room-meta,
  .room-card.warning .room-meta,
  .room-card.finished .room-meta {
    flex: 0 0 auto;
    min-height: 0;
    margin-top: 2px;
  }

  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: clamp(42px, 5.7vh, 72px);
    font-size: clamp(31px, 3vw, 52px);
  }

  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display {
    margin: 3px 0 2px;
    font-size: clamp(28px, 2.35vw, 43px);
  }

  .room-card.running .course-summary,
  .room-card.warning .course-summary,
  .room-card.finished .course-summary {
    min-height: 18px;
    font-size: clamp(12px, 1vw, 18px);
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    margin-top: auto;
    gap: 7px !important;
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: clamp(48px, 6.5vh, 82px) !important;
    font-size: clamp(17px, 1.4vw, 25px) !important;
  }

  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button {
    min-height: clamp(30px, 3.8vh, 48px) !important;
    font-size: clamp(13px, 1vw, 18px) !important;
  }

  .room-actions.single-action .alarm-stop-button {
    min-height: clamp(58px, 8vh, 100px) !important;
    font-size: clamp(22px, 1.8vw, 34px) !important;
  }

  .summary-card {
    height: auto;
    min-height: 0;
    padding: 8px;
    border-radius: 8px;
  }

  .section-title-row { margin-bottom: 5px; }
  .summary-card .section-title-row h2 { font-size: clamp(19px, 1.45vw, 27px); }
  .summary-list { gap: 4px; max-height: calc(100% - 38px); }
  .summary-list li {
    min-height: clamp(30px, 4vh, 45px);
    padding: 4px 7px;
    font-size: clamp(10px, .85vw, 15px);
  }

  footer { margin: 0; align-self: end; }
  footer p { font-size: 8px; line-height: 1; }
}

/* 768px前後の高さでもカード内の枠を最大限広げつつ、スクロールさせない */
@media (min-width: 901px) and (max-height: 820px) {
  .app-shell { grid-template-rows: 57px minmax(0, 1fr) 0; padding: 3px 4px; }
  .topbar { min-height: 57px; }
  .header-clock time { font-size: 38px; }
  footer { display: none; }
  .room-card { padding: 5px 7px 6px; }
  .room-card.idle .course-selector-label { margin-top: 5px; }
  .room-card.idle .room-actions { margin-top: 5px; gap: 4px !important; }
  .room-card.idle .room-actions .start-button { min-height: 48px !important; }
  .room-card.idle .room-actions .prestart-reset-button { min-height: 27px !important; }
  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions { gap: 4px !important; }
  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button { min-height: 40px !important; }
  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button { min-height: 26px !important; }
}

/* PC TEST 1.3: リセット見切れ防止／空室を待機中と同じ高さに統一 */
@media (min-width: 901px) {
  /* 空室も待機中と同じく、カード内の残り高さいっぱいを使用 */
  .room-card.vacant .course-selector-label {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    margin: 8px 0 0;
    padding: 0;
  }

  .room-card.vacant .course-select-trigger,
  .room-card.vacant .course-select-display {
    width: 100% !important;
    height: 100%;
    min-height: 0 !important;
  }

  .room-card.vacant .course-select-trigger {
    display: flex;
    flex: 1 1 auto;
    padding: 0;
    border-radius: 10px;
  }

  .room-card.vacant .course-select-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: clamp(27px, 2.15vw, 42px);
    line-height: 1;
  }

  /* 稼働中は上部情報を必要以上に伸ばさず、操作ボタンを必ずカード内に収める */
  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    overflow: hidden !important;
  }

  .room-card.running .room-meta,
  .room-card.warning .room-meta,
  .room-card.finished .room-meta,
  .room-card.running .timer-label,
  .room-card.warning .timer-label,
  .room-card.finished .timer-label,
  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display,
  .room-card.running .course-summary,
  .room-card.warning .course-summary,
  .room-card.finished .course-summary {
    flex-shrink: 0;
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    flex: 0 0 auto;
    width: 100%;
    margin-top: auto;
    padding-bottom: 0;
  }

  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: clamp(40px, 5.1vh, 64px);
  }

  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display {
    font-size: clamp(27px, 2.15vw, 40px);
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: clamp(44px, 5.5vh, 70px) !important;
  }

  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button {
    min-height: clamp(28px, 3.4vh, 42px) !important;
  }
}

@media (min-width: 901px) and (max-height: 900px) {
  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    min-height: 44px;
    font-size: clamp(28px, 2.5vw, 44px);
  }

  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display {
    font-size: clamp(25px, 2vw, 36px);
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    gap: 4px !important;
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    min-height: 42px !important;
  }

  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button {
    min-height: 28px !important;
  }
}


/* PC TEST 1.4: リセットを完全にカード内へ収め、ヘッダー日付の重なりを解消 */
@media (min-width: 901px) {
  /* 時計と日付をヘッダー内に確実に収める。フッター分は部屋カードへ割り当てる */
  .app-shell {
    grid-template-rows: 70px minmax(0, 1fr) 0 !important;
  }

  .topbar {
    position: relative;
    z-index: 2;
    height: 70px;
    min-height: 70px !important;
    overflow: hidden;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .header-clock {
    min-height: 0;
    align-self: center;
    overflow: hidden;
  }

  .header-clock time {
    font-size: clamp(40px, 3.55vw, 55px) !important;
    line-height: .9;
  }

  .header-clock span {
    display: block;
    margin-top: 3px !important;
    font-size: 9px !important;
    line-height: 1;
  }

  main {
    position: relative;
    z-index: 1;
  }

  footer {
    display: none !important;
  }

  /* 稼働中カードは各要素の高さを整理し、操作ボタン2個を必ず表示する */
  .room-card.running,
  .room-card.warning,
  .room-card.finished {
    min-height: 0;
    overflow: hidden !important;
    padding: 6px 8px 7px !important;
  }

  .room-card.running .room-card-top,
  .room-card.warning .room-card-top,
  .room-card.finished .room-card-top {
    flex: 0 0 auto;
    min-height: 28px;
  }

  .room-card.running h3,
  .room-card.warning h3,
  .room-card.finished h3 {
    font-size: clamp(25px, 1.75vw, 32px) !important;
  }

  .room-card.running .room-meta,
  .room-card.warning .room-meta,
  .room-card.finished .room-meta {
    flex: 0 0 auto;
    gap: 2px;
    min-height: 0 !important;
    margin-top: 0 !important;
  }

  .room-card.running .room-meta span,
  .room-card.warning .room-meta span,
  .room-card.finished .room-meta span,
  .room-card.running .timer-label,
  .room-card.warning .timer-label,
  .room-card.finished .timer-label {
    font-size: 8px !important;
    line-height: 1;
  }

  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    height: clamp(44px, 4.8vh, 54px) !important;
    min-height: clamp(44px, 4.8vh, 54px) !important;
    max-height: 54px;
    font-size: clamp(29px, 2.65vw, 46px) !important;
    line-height: 1 !important;
  }

  .room-card.running .timer-label,
  .room-card.warning .timer-label,
  .room-card.finished .timer-label {
    margin-top: 4px !important;
  }

  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display {
    flex: 0 0 auto;
    margin: 2px 0 1px !important;
    font-size: clamp(26px, 2.15vw, 38px) !important;
    line-height: .95 !important;
  }

  .room-card.running .course-summary,
  .room-card.warning .course-summary,
  .room-card.finished .course-summary {
    flex: 0 0 auto;
    min-height: 17px !important;
    margin: 0 !important;
    font-size: clamp(12px, .95vw, 17px) !important;
    line-height: 1 !important;
  }

  .room-card.running .room-actions,
  .room-card.warning .room-actions,
  .room-card.finished .room-actions {
    flex: 0 0 auto;
    width: 100%;
    gap: 5px !important;
    margin-top: auto !important;
    padding: 0 !important;
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    height: clamp(46px, 5.2vh, 58px) !important;
    min-height: clamp(46px, 5.2vh, 58px) !important;
    max-height: 58px;
    padding: 5px 8px !important;
    font-size: clamp(16px, 1.25vw, 22px) !important;
    line-height: 1.05 !important;
  }

  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button {
    display: block;
    height: clamp(30px, 3.2vh, 38px) !important;
    min-height: clamp(30px, 3.2vh, 38px) !important;
    max-height: 38px;
    padding: 3px 8px !important;
    font-size: clamp(12px, .95vw, 16px) !important;
    line-height: 1 !important;
  }

  /* 空室と待機中の大枠は同じ縦幅を維持 */
  .room-card.idle .course-selector-label,
  .room-card.vacant .course-selector-label {
    min-height: 0 !important;
  }

  .room-card.idle .course-select-trigger,
  .room-card.idle .course-select-display,
  .room-card.vacant .course-select-trigger,
  .room-card.vacant .course-select-display {
    height: 100% !important;
    min-height: 0 !important;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .app-shell {
    grid-template-rows: 62px minmax(0, 1fr) 0 !important;
  }

  .topbar {
    height: 62px;
    min-height: 62px !important;
  }

  .header-clock time {
    font-size: 40px !important;
  }

  .header-clock span {
    margin-top: 1px !important;
    font-size: 8px !important;
  }

  .room-card.running .room-meta strong,
  .room-card.warning .room-meta strong {
    height: 40px !important;
    min-height: 40px !important;
    font-size: 30px !important;
  }

  .room-card.running .timer-display,
  .room-card.warning .timer-display,
  .room-card.finished .timer-display {
    font-size: 25px !important;
  }

  .room-card.running .room-actions .adjust-button,
  .room-card.warning .room-actions .adjust-button {
    height: 39px !important;
    min-height: 39px !important;
  }

  .room-card.running .room-actions .reset-button,
  .room-card.warning .room-actions .reset-button,
  .room-card.finished .room-actions .reset-button {
    height: 27px !important;
    min-height: 27px !important;
  }
}


/* PC TEST 1.6 */
@media (min-width: 901px) {
  .room-card .room-card-top { justify-content:center !important; min-height:38px; text-align:center; }
  .room-card .room-title-block { width:100%; justify-content:center; }
  .room-card h3 { font-size:clamp(36px,2.55vw,48px) !important; font-weight:950 !important; line-height:.95 !important; text-align:center; }
  .room-card.running h3,.room-card.warning h3,.room-card.finished h3 { font-size:clamp(34px,2.35vw,44px) !important; }
  .ended-card .section-title-row { justify-content:flex-start !important; }
  .room-card.idle .start-button[hidden],
  .room-card.idle .prestart-reset-button[hidden],
  .room-card.vacant .room-actions,
  .room-card.vacant .start-button,
  .room-card.vacant .prestart-reset-button { display:none !important; }
}


/* PC TEST 1.7: 再読み込み直後の操作ボタンちらつきを防止 */
.start-button[hidden],
.prestart-reset-button[hidden],
.room-actions button[hidden] {
  display: none !important;
}


/* PC TEST 1.9: 更新直後のスタート誤表示を完全防止 */
.room-card.idle .start-button,
.room-card.vacant .start-button {
  display: none !important;
}

/* コース選択済みのカードだけスタートを表示 */
.room-card.idle.course-selected .start-button:not([hidden]) {
  display: flex !important;
}

/* 未選択時は操作欄自体の余分な高さを持たせない */
.room-card.idle:not(.course-selected) .room-actions {
  min-height: 0 !important;
}


/* PC TEST 2.0: 終了後のアラーム停止／停止後リセットを大きく同一サイズに統一 */
@media (min-width: 901px) {
  .room-card.finished .room-actions.single-action {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    margin-top: auto !important;
    gap: 0 !important;
  }

  .room-card.finished .room-actions.single-action .reset-button,
  .room-card.finished .room-actions.single-action .alarm-stop-button,
  .room-card.finished.alarm-silenced .room-actions.single-action .reset-button:not(.alarm-stop-button) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    height: clamp(58px, 7vh, 78px) !important;
    min-height: clamp(58px, 7vh, 78px) !important;
    max-height: 78px !important;
    padding: 8px 12px !important;
    border-radius: 11px !important;
    font-size: clamp(18px, 1.45vw, 25px) !important;
    font-weight: 950 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .room-card.finished .room-actions.single-action .reset-button,
  .room-card.finished .room-actions.single-action .alarm-stop-button,
  .room-card.finished.alarm-silenced .room-actions.single-action .reset-button:not(.alarm-stop-button) {
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    font-size: 18px !important;
  }
}
