/* 授業用タイマー（大きく表示）のスタイル */

.timer-wrap {
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 0 16px;
}

/* ---- タイマー本体（ステージ） ---- */
.timer-stage {
  position: relative;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 16px;
  padding: 24px 16px 20px;
  text-align: center;
  overflow: hidden;
  transition: background-color 0.6s ease, color 0.6s ease;
}

.timer-stage.warn {
  background: #eab308;
  color: #1c1917;
}

.timer-stage.danger {
  background: #dc2626;
  color: #ffffff;
}

.timer-status {
  font-size: 16px;
  color: inherit;
  opacity: 0.75;
  min-height: 1.5em;
  margin: 0 0 2px;
}

.timer-display {
  font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(80px, 17vw, 230px);
  line-height: 1.08;
  letter-spacing: 0.01em;
  color: inherit;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.timer-stage.has-hours .timer-display {
  font-size: clamp(56px, 12vw, 170px);
}

.timer-stage.finished .timer-display {
  animation: timer-blink 0.9s steps(2, jump-none) 6;
}

/* 終了時のフラッシュ */
.timer-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.timer-stage.finished .timer-flash {
  animation: timer-flash 0.45s ease-in-out 8;
}

@keyframes timer-flash {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.8; }
}

@keyframes timer-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .timer-stage.finished .timer-flash { animation: timer-flash 0.45s ease-in-out 2; }
  .timer-stage.finished .timer-display { animation: none; }
}

/* ---- ステージ内の操作ボタン ---- */
.timer-controls {
  position: relative;
  color: inherit; /* common.cssの *{color} 打ち消し（ボタンはここからinherit） */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.timer-controls button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.15s;
}

.timer-stage.warn .timer-controls button {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.1);
}

.timer-controls button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.timer-controls .btn-primary {
  font-size: 19px;
  padding: 10px 34px;
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.timer-controls .btn-primary:hover {
  background: #2563eb;
}

/* ---- 全画面時 ---- */
.timer-stage.is-fullscreen {
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
}

.timer-stage.is-fullscreen .timer-display {
  font-size: min(29vw, 56vh);
}

.timer-stage.is-fullscreen.has-hours .timer-display {
  font-size: min(20vw, 44vh);
}

.timer-stage.is-fullscreen .timer-status {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  font-size: 20px;
  opacity: 0.55;
}

.timer-stage.is-fullscreen .timer-controls {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  margin-top: 0;
  opacity: 0.3;
  transition: opacity 0.25s;
}

.timer-stage.is-fullscreen .timer-controls:hover,
.timer-stage.is-fullscreen .timer-controls:focus-within {
  opacity: 1;
}

/* ---- 設定エリア（プリセット・自由入力・モード） ---- */
.timer-settings {
  max-width: 800px;
  margin: 20px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mode-switch {
  display: inline-flex;
  align-self: center;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
}

.mode-switch button {
  appearance: none;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  min-height: 40px;
}

.mode-switch button[aria-pressed='true'] {
  background: #1e293b;
  color: #fff;
}

.preset-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-row button {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-size: 17px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 46px;
  min-width: 72px;
  transition: background-color 0.15s, border-color 0.15s;
}

.preset-row button:hover {
  border-color: #3b82f6;
}

.preset-row button.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.custom-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-row .custom-label {
  font-size: 14px;
  color: #64748b;
}

.custom-row input[type='number'] {
  width: 80px;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-align: right;
  color: #1e293b;
  background: #fff;
  box-sizing: border-box;
  min-height: 44px;
}

.custom-row .unit {
  font-size: 15px;
  color: #475569;
}

.custom-row .btn-set {
  appearance: none;
  border: 1px solid #1e293b;
  background: #1e293b;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.custom-row .btn-set:hover {
  background: #334155;
}

/* ストップウォッチモードでは時間設定を隠す */
.timer-settings.mode-up .preset-row,
.timer-settings.mode-up .custom-row {
  display: none;
}

.kbd-hint {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.kbd-hint kbd {
  display: inline-block;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-family: inherit;
  padding: 1px 7px;
  margin: 0 2px;
}

@media (max-width: 600px) {
  .timer-stage {
    padding: 18px 10px 16px;
  }

  .timer-display {
    font-size: clamp(64px, 21vw, 140px);
  }

  .timer-controls .btn-primary {
    font-size: 17px;
    padding: 10px 24px;
  }
}
