* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at center, #17243a 0%, #070b12 60%, #000 100%);
  color: #f7f9ff;
}

button,
input,
select {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(139, 183, 245, 0.5);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.9);
  color: #f7f9ff;
  outline: none;
}

input {
  padding: 10px 12px;
}

select {
  padding: 10px 38px 10px 12px;
}

input:focus,
select:focus {
  border-color: #8fbaff;
  box-shadow: 0 0 0 3px rgba(93, 147, 255, 0.2);
}

.app-shell {
  width: min(1920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 32px);
}

.screen[hidden] {
  display: none;
}

.page-header {
  margin-bottom: clamp(20px, 2vw, 34px);
  text-align: center;
}

.page-header h1,
.page-header p,
.section-heading h2 {
  margin: 0;
}

.page-header h1 {
  font-size: clamp(1.8rem, 3vw, 3.1rem);
}

.page-header p {
  margin-top: 7px;
  color: #aebfd8;
  font-size: clamp(0.9rem, 1.2vw, 1.15rem);
}

.setup-form {
  display: grid;
  gap: clamp(20px, 2.4vw, 34px);
}

.setup-group {
  padding: clamp(16px, 2vw, 28px);
  border: 1px solid rgba(151, 190, 245, 0.35);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(23, 39, 63, 0.88), rgba(7, 13, 24, 0.93));
  box-shadow: 0 0 28px rgba(85, 139, 226, 0.12);
}

.setup-group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 200px);
  gap: 18px;
  margin-bottom: 18px;
}

.field-block {
  display: grid;
  gap: 7px;
}

.field-block label {
  color: #dbe8fb;
  font-weight: 700;
}

.timer-settings-list {
  display: grid;
  gap: 12px;
}

.timer-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(131, 169, 224, 0.22);
  border-radius: 16px;
  background: rgba(5, 12, 23, 0.48);
}

.duration-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 110px));
  gap: 10px;
}

.setup-error {
  min-height: 1.5em;
  margin: -10px 0 0;
  color: #ff9b9b;
  font-weight: 700;
  text-align: center;
}

.setup-actions {
  display: flex;
  justify-content: center;
  padding-bottom: 20px;
}

.primary-button,
.secondary-button {
  min-height: 56px;
  padding: 11px 24px;
  border: 1px solid #84b6ff;
  border-radius: 15px;
  color: #eef5ff;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(145deg, #376cff, #1541b8);
  box-shadow: 0 0 18px rgba(71, 126, 255, 0.35), inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.secondary-button {
  border-color: rgba(151, 184, 227, 0.58);
  background: rgba(21, 34, 54, 0.92);
  box-shadow: inset 0 0 10px rgba(122, 169, 236, 0.08);
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled),
.secondary-button:hover,
.secondary-button:focus-visible {
  filter: brightness(1.14);
  outline: 3px solid rgba(155, 198, 255, 0.32);
  outline-offset: 3px;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.create-board-button {
  width: min(440px, 100%);
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
}

.timer-section {
  margin-bottom: clamp(24px, 3vw, 44px);
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(var(--timer-count, 4), minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 22px);
}

.timer-panel {
  min-width: 0;
  perspective: 1200px;
  transition: opacity 0.35s ease;
}

.timer-panel-inner {
  display: grid;
  width: 100%;
  min-height: clamp(250px, 22vw, 390px);
  transform-style: preserve-3d;
  transition: transform 0.7s ease-in-out;
}

.timer-panel.is-finished {
  opacity: 0.7;
}

.timer-panel.is-finished .timer-panel-inner {
  transform: rotateY(180deg);
}

.timer-face {
  grid-area: 1 / 1;
  display: grid;
  width: 100%;
  padding: clamp(12px, 1.4vw, 24px);
  border: 1px solid rgba(182, 211, 255, 0.55);
  border-radius: clamp(18px, 2vw, 32px);
  background: linear-gradient(145deg, rgba(32, 50, 78, 0.92), rgba(6, 12, 23, 0.96));
  box-shadow: 0 0 24px rgba(116, 168, 255, 0.16), inset 0 0 24px rgba(158, 200, 255, 0.08);
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.timer-face-front {
  align-content: center;
  gap: clamp(16px, 2vw, 30px);
}

.timer-face-back {
  align-content: center;
  justify-items: center;
  transform: rotateY(180deg);
}

.timer-title {
  max-width: 100%;
  margin: 0;
  color: #eef5ff;
  font-size: clamp(1.55rem, 2.7vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  text-shadow: 0 0 16px rgba(159, 198, 255, 0.36);
  overflow-wrap: anywhere;
}

.time-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0;
  width: 100%;
}

.minutes-display,
.seconds-display,
.time-colon {
  color: #fff;
  font-family: Consolas, "Roboto Mono", "Courier New", monospace;
  font-weight: 700;
  line-height: 0.9;
  text-shadow: 0 0 11px rgba(255, 255, 255, 0.52), 0 0 26px rgba(153, 194, 255, 0.22);
}

.minutes-display,
.seconds-display {
  min-width: 0;
  font-size: clamp(4rem, 8.3vw, 8.8rem);
  letter-spacing: -0.09em;
}

.time-colon {
  padding: 0 0.02em 0.08em;
  font-size: clamp(3rem, 5.2vw, 5.8rem);
}

.finished-message {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.finished-title,
.finished-text {
  max-width: 100%;
  margin: 0;
  color: #fff;
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.4), 0 0 28px rgba(153, 194, 255, 0.24);
}

.finished-title {
  font-size: clamp(1.8rem, 3.3vw, 3.6rem);
}

.finished-text {
  font-size: clamp(3.5rem, 6.3vw, 7rem);
  letter-spacing: 0.08em;
}

.overall-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-bottom: 18px;
}

.start-all-button,
.finish-button {
  min-width: min(320px, 46%);
  min-height: 66px;
  font-size: clamp(1.25rem, 2vw, 1.9rem);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1100px) {
  .timer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .minutes-display,
  .seconds-display {
    font-size: clamp(4.4rem, 13vw, 8rem);
  }
}

@media (max-width: 700px) {
  .setup-group-header,
  .timer-setting-row {
    grid-template-columns: 1fr;
  }

  .duration-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

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

  .timer-panel-inner {
    min-height: 300px;
  }

  .minutes-display,
  .seconds-display {
    font-size: clamp(5.2rem, 29vw, 9rem);
  }

  .time-colon {
    font-size: clamp(3.6rem, 15vw, 5.4rem);
  }

  .overall-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .start-all-button,
  .finish-button {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


.setup-subheading {
  margin: 0 0 14px;
  font-size: clamp(1.2rem, 1.8vw, 1.6rem);
}

.board-title-setup {
  background: linear-gradient(145deg, rgba(22, 36, 58, 0.9), rgba(7, 13, 24, 0.94));
}

/* 上段・下段を遠くから見分けやすくする薄い背景色 */
.timer-section-upper,
.timer-section-lower {
  padding: clamp(14px, 1.5vw, 24px);
  border: 1px solid rgba(166, 198, 241, 0.18);
  border-radius: clamp(18px, 2vw, 28px);
}

.timer-section-upper {
  background:
    linear-gradient(145deg, rgba(38, 88, 150, 0.14), rgba(7, 13, 24, 0.38));
  box-shadow:
    inset 0 0 32px rgba(74, 133, 219, 0.06),
    0 0 22px rgba(50, 104, 180, 0.06);
}

.timer-section-lower {
  background:
    linear-gradient(145deg, rgba(92, 57, 137, 0.14), rgba(7, 13, 24, 0.38));
  box-shadow:
    inset 0 0 32px rgba(133, 86, 190, 0.06),
    0 0 22px rgba(95, 59, 145, 0.06);
}

.timer-section[hidden],
.timer-settings-list[hidden] {
  display: none;
}
