* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #1f2933;
  color: #f5f7fa;
  transition: background-color 0.4s;
}

/* 作業中：赤系／休憩中：緑系。フェーズは main.js が body[data-phase] に入れる */
body[data-phase="work"] {
  background: #b83227;
}

body[data-phase="break"] {
  background: #1e7a57;
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 16px;
  text-align: center;
}

.phase {
  margin: 0;
  font-size: 1.5rem;
  font-weight: bold;
}

.remaining {
  margin: 0.25em 0 0;
  font-size: clamp(4rem, 22vw, 10rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* 自動再生が拒否されたときだけ出す小さな案内。画面のどこをタップしても音が有効になる */
.sound-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.5em 1em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.95rem;
  white-space: nowrap;
  pointer-events: none;
}

.sound-hint[hidden] {
  display: none;
}

/* 設定（工程10）。右上の歯車ボタンで開く */
.settings-button {
  position: fixed;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  cursor: pointer;
}

.settings-button:hover,
.settings-button:focus-visible {
  background: rgba(0, 0, 0, 0.35);
}

.settings {
  width: min(360px, calc(100% - 32px));
  padding: 20px;
  border: none;
  border-radius: 12px;
  background: #f5f7fa;
  color: #1f2933;
}

.settings::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.settings-title {
  margin: 0 0 16px;
  font-size: 1.25rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: bold;
}

.settings-field select {
  width: 100%;
  padding: 8px;
  font: inherit;
  font-weight: normal;
}

/* 音楽ファイル（工程11） */
.settings-field + .settings-note + .settings-field {
  margin-top: 20px;
}

/* 画面スリープ防止（工程12） */
.settings-field + .settings-field {
  margin-top: 20px;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
}

.settings-check input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.music-name {
  margin: 0;
  font-weight: normal;
  overflow-wrap: anywhere;
}

.music-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.music-button {
  position: relative;
  padding: 8px 14px;
  border: 1px solid #9aa5b1;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: normal;
  cursor: pointer;
}

.music-button:focus-within,
.music-button:focus-visible {
  outline: 2px solid #1f2933;
  outline-offset: 2px;
}

/* ファイル選択の入力欄は見えなくし、外側のラベルをボタンとして見せる */
.music-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.music-button[hidden] {
  display: none;
}

.settings-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #52606d;
}

.settings-note[hidden] {
  display: none;
}

.settings-close {
  display: block;
  margin: 20px 0 0 auto;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: #1f2933;
  color: #f5f7fa;
  font: inherit;
  cursor: pointer;
}
