:root {
  color-scheme: light;
  --sand-color: #54bea7;
  --sand-color-strong: #207c6e;
  --page-bg: #f8fbf7;
  --page-bg-2: #dff6ef;
  --ink: #173530;
  --muted: #5f746e;
  --line: rgba(27, 68, 60, 0.15);
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 48px rgba(31, 70, 62, 0.14);
  --radius: 8px;
  font-family: ui-rounded, "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 222, 139, 0.34), transparent 26rem),
    radial-gradient(circle at 88% 18%, rgba(152, 214, 247, 0.34), transparent 28rem),
    linear-gradient(145deg, var(--page-bg), var(--page-bg-2));
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("./assets/mascot/liflo-family.png");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: min(90vw, 860px) auto;
  opacity: 0;
}

body.has-background-mascot::before {
  opacity: 0.085;
}

body.has-dialog-fallback {
  overflow: hidden;
}

body.has-dialog-fallback::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(11, 29, 26, 0.42);
  backdrop-filter: blur(5px);
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 920px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(max(14px, env(safe-area-inset-top)) + 4px) max(16px, env(safe-area-inset-right)) calc(max(20px, env(safe-area-inset-bottom)) + 2px) max(16px, env(safe-area-inset-left));
  text-align: center;
}

.app-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.2vw, 10px);
  min-width: 0;
  text-align: center;
}

.brand-title-icon {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(0 3px 0 color-mix(in srgb, var(--sand-color) 36%, transparent))
    drop-shadow(0 7px 12px color-mix(in srgb, var(--sand-color-strong) 18%, transparent))
    drop-shadow(0 8px 14px rgba(23, 53, 48, 0.12));
}

.brand-title-icon-face {
  width: clamp(40px, 8vw, 58px);
}

.brand-title-icon-hourglass {
  width: clamp(24px, 4.4vw, 34px);
}

.brand-title-text {
  min-width: 0;
  max-width: min(100%, 430px);
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.24rem, 5vw, 2rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.9),
    0 4px 0 color-mix(in srgb, var(--sand-color) 38%, transparent),
    0 8px 14px color-mix(in srgb, var(--sand-color-strong) 20%, transparent),
    0 8px 18px rgba(36, 77, 68, 0.13);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.brand-lockup span,
.settings-sheet header span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1,
.settings-sheet h2 {
  margin: 0;
  font-size: clamp(1.22rem, 4.4vw, 1.9rem);
  letter-spacing: 0;
}

.icon-button {
  display: inline-grid;
  width: 58px;
  height: 58px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(36, 77, 68, 0.11);
  cursor: pointer;
}

.icon-button:active,
.primary-action:active,
.secondary-action:active,
.digit-step-button:active,
.sound-pattern-button:active,
.transition-summary:active {
  transform: translateY(1px);
}

.icon-gear,
.icon-sound,
.icon-close {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
}

.icon-svg {
  width: 29px;
  height: 29px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-svg .sound-mute-mark {
  display: none;
}

.is-muted .icon-svg .sound-wave {
  display: none;
}

.is-muted .icon-svg .sound-mute-mark {
  display: block;
}

.icon-gear::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 3px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -8px 0 -6px currentColor, 0 8px 0 -6px currentColor, 8px 0 0 -6px currentColor, -8px 0 0 -6px currentColor;
}

.icon-gear::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: currentColor;
  border-radius: 50%;
}

.icon-sound::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 7px;
  width: 8px;
  height: 8px;
  background: currentColor;
  clip-path: polygon(0 25%, 45% 25%, 100% 0, 100% 100%, 45% 75%, 0 75%);
}

.icon-sound::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 4px;
  width: 11px;
  height: 14px;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

.is-muted .icon-sound::after {
  width: 17px;
  height: 2px;
  top: 10px;
  right: 1px;
  border: 0;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-38deg);
}

.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-close::before {
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

.timer-layout {
  display: grid;
  flex: 1 0 auto;
  justify-items: center;
  gap: clamp(10px, 1.8vh, 14px);
  padding-top: 12px;
}

.app-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 18px;
  color: rgba(23, 53, 48, 0.56);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.task-strip {
  display: block;
  width: min(100%, 720px);
}

.transition-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
  position: relative;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.42)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(218, 246, 239, 0.54));
  box-shadow: 0 14px 36px rgba(36, 77, 68, 0.1);
  overflow: hidden;
}

.transition-summary {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 260px);
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(221, 250, 239, 0.84));
  color: var(--ink);
  text-align: center;
  box-shadow: 0 10px 28px rgba(36, 77, 68, 0.08);
}

.transition-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.transition-summary strong {
  color: var(--sand-color-strong);
  font-size: clamp(1.16rem, 3.4vw, 1.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: center;
  line-height: 1;
}

.action-select {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(37, 139, 119, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 0 34px 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  text-align-last: center;
  font-size: clamp(1.28rem, 5vw, 2rem);
  font-weight: 900;
  line-height: 1.1;
  outline: 0;
  cursor: pointer;
}

.action-select:focus-visible {
  outline: 3px solid rgba(37, 139, 119, 0.28);
  outline-offset: 2px;
}

.transition-progress {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: rgba(23, 53, 48, 0.08);
  overflow: hidden;
}

.transition-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sand-color-strong), var(--sand-color));
  transition: width 160ms linear;
}

.timer-stage {
  display: grid;
  justify-items: center;
  width: min(100%, 720px);
  min-height: 0;
  padding-top: 12px;
}

.hourglass-panel {
  display: grid;
  justify-items: center;
  align-content: center;
  width: min(100%, 620px);
  padding: 0;
}

.hourglass-canvas {
  display: block;
  width: min(60vw, 324px, calc(39svh * 520 / 680));
  min-width: 220px;
  height: auto;
  margin-top: 0;
  aspect-ratio: 520 / 680;
}

.time-readout {
  margin-top: -2px;
  font-size: clamp(3.35rem, 12vw, 5.3rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: 0;
}

.digit-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 420px);
  margin-top: 18px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 10px 26px rgba(36, 77, 68, 0.08);
}

.digit-control {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}

.digit-control span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.digit-step-button {
  display: grid;
  width: 38px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 7px 16px rgba(36, 77, 68, 0.08);
  cursor: pointer;
}

.digit-step-button:focus-visible {
  outline: 3px solid rgba(37, 139, 119, 0.28);
  outline-offset: 2px;
}

.action-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.34fr);
  gap: 10px;
  width: min(100%, 420px);
  margin-top: 32px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: var(--radius);
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.primary-action {
  border: 0;
  background: linear-gradient(135deg, var(--sand-color-strong), var(--sand-color));
  color: #fff;
  box-shadow: 0 14px 24px rgba(37, 139, 119, 0.24);
}

.secondary-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.side-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 720px);
  margin-top: 2px;
}

.control-band {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  width: min(100%, 640px);
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
}

.color-row,
.sound-pattern-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow-x: visible;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.color-row::-webkit-scrollbar,
.sound-pattern-row::-webkit-scrollbar {
  display: none;
}

.color-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, 44px);
  justify-content: center;
  width: min(100%, 360px);
  gap: 10px;
  padding: 2px 0 0;
}

.sound-pattern-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 720px);
  overflow: visible;
}

.sound-pattern-button {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 7px 10px;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.sound-pattern-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(37, 139, 119, 0.14), 0 5px 12px rgba(36, 77, 68, 0.08);
  font-size: 0.95rem;
  line-height: 1;
}

.sound-pattern-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-pattern-button.is-plus-locked {
  border-style: dashed;
  color: rgba(23, 53, 48, 0.48);
  background: rgba(255, 255, 255, 0.46);
}

.sound-pattern-button.is-plus-locked .sound-pattern-icon {
  opacity: 0.56;
}

.sound-pattern-button.is-selected {
  border-color: rgba(37, 139, 119, 0.48);
  background: rgba(219, 250, 238, 0.94);
  color: var(--sand-color-strong);
}

.color-swatch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line), 0 8px 18px rgba(36, 77, 68, 0.12);
  cursor: pointer;
}

.color-swatch.is-custom {
  background: conic-gradient(#ff6375, #ffc94a, #75d95b, #56cfe1, #6b7cff, #ba68ff, #ff6375);
}

.color-swatch.is-custom::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: inherit;
  background: var(--custom-swatch);
  box-shadow: 0 2px 7px rgba(23, 53, 48, 0.18);
}

.color-swatch.is-selected {
  box-shadow: 0 0 0 3px var(--ink), 0 8px 18px rgba(36, 77, 68, 0.12);
}

.color-swatch.is-plus-locked {
  filter: saturate(0.72) brightness(1.1);
  opacity: 0.46;
}

.lock-mark {
  position: absolute;
  top: -4px;
  right: -4px;
  display: block;
  width: 17px;
  height: 14px;
  border: 2px solid rgba(23, 53, 48, 0.64);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 7px rgba(23, 53, 48, 0.14);
  pointer-events: none;
}

.lock-mark::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -8px;
  width: 7px;
  height: 8px;
  border: 2px solid rgba(23, 53, 48, 0.64);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.color-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-color-panel {
  grid-column: 1 / -1;
  display: grid;
  width: min(100%, 520px);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(37, 139, 119, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(36, 77, 68, 0.08);
}

.custom-color-panel[hidden] {
  display: none;
}

.custom-color-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.mini-close-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.custom-color-preview {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--preview-color);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(23, 53, 48, 0.12);
}

.color-slider {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.color-slider input {
  width: 100%;
  accent-color: var(--sand-color-strong);
}

.custom-color-presets {
  display: grid;
  grid-template-columns: repeat(10, 28px);
  justify-content: center;
  gap: 8px;
}

.custom-color-preset {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: var(--preset-color);
  box-shadow: 0 0 0 1px var(--line), 0 5px 12px rgba(36, 77, 68, 0.1);
}

.custom-color-preset.is-selected {
  box-shadow: 0 0 0 3px var(--ink), 0 5px 12px rgba(36, 77, 68, 0.1);
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(11, 29, 26, 0.42);
  backdrop-filter: blur(5px);
}

dialog.is-dialog-fallback[open] {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 19;
  max-height: min(88svh, 820px);
  margin: 0;
  overflow: auto;
  transform: translate(-50%, -50%);
}

.finish-dialog,
.parent-gate-dialog,
.plus-dialog,
.sound-dialog {
  width: min(92vw, 390px);
}

.sound-dialog {
  width: min(94vw, 430px);
}

.finish-content,
.parent-gate-sheet,
.plus-sheet,
.sound-sheet,
.settings-sheet {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(232, 250, 246, 0.98));
  box-shadow: var(--shadow);
}

.finish-content {
  display: grid;
  justify-items: center;
  padding: 22px 18px 18px;
  text-align: center;
}

.finish-mascot {
  display: block;
  width: min(50vw, 180px);
  max-width: 100%;
  height: auto;
  margin-bottom: 4px;
  filter: drop-shadow(0 14px 22px rgba(32, 73, 65, 0.16));
}

.finish-kicker {
  margin: 8px 0 0;
  color: var(--sand-color-strong);
  font-size: 0.8rem;
  font-weight: 900;
}

.finish-content h2 {
  margin: 3px 0 0;
  font-size: 2rem;
}

.finish-content p {
  color: var(--muted);
  font-weight: 800;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 10px;
}

.parent-gate-sheet {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
}

.plus-sheet {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  text-align: center;
}

.plus-kicker {
  margin: 0;
  color: var(--sand-color-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.plus-sheet h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.42rem;
  line-height: 1.25;
}

.plus-sheet p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.plus-sheet small {
  color: rgba(72, 99, 93, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.4;
}

.plus-link-action {
  display: grid;
  min-height: 48px;
  place-items: center;
  text-decoration: none;
}

.sound-sheet {
  display: grid;
  gap: 14px;
  max-height: min(86svh, 680px);
  overflow: auto;
  padding: 16px;
}

.sound-sheet header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  text-align: center;
}

.sound-sheet header::before {
  content: "";
  display: block;
  width: 58px;
  height: 1px;
}

.sound-sheet header span {
  grid-column: 2;
  color: var(--sand-color-strong);
  font-weight: 900;
}

.sound-sheet header .icon-button {
  grid-column: 3;
}

.sound-sheet header .icon-close {
  transform: translateX(-9px);
}

.sound-enabled-row {
  width: 100%;
}

.sound-choice-section {
  display: grid;
  gap: 9px;
  width: 100%;
}

.sound-choice-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 900;
  text-align: center;
}

.sound-sheet .sound-pattern-row {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.parent-gate-sheet header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  width: 100%;
}

.parent-gate-sheet header::before {
  content: "";
  display: block;
  width: 58px;
}

.parent-gate-sheet header span {
  grid-column: 2;
  color: var(--sand-color-strong);
  font-weight: 900;
}

.parent-gate-sheet header .icon-button {
  grid-column: 3;
}

.parent-gate-sheet p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}

.parent-question {
  display: grid;
  min-height: 58px;
  place-items: center;
  width: min(100%, 250px);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(219, 250, 238, 0.9), rgba(255, 255, 255, 0.84));
  color: var(--ink);
  font-size: 1.9rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.parent-gate-sheet input {
  width: min(100%, 250px);
  min-height: 52px;
  border: 1px solid rgba(37, 139, 119, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  outline: 0;
}

.parent-gate-sheet input:focus-visible {
  outline: 3px solid rgba(37, 139, 119, 0.24);
  outline-offset: 2px;
}

.parent-gate-error {
  min-height: 1.4em;
  color: #a43d32 !important;
}

.settings-dialog {
  width: min(94vw, 720px);
}

.settings-sheet {
  display: grid;
  gap: 18px;
  max-height: min(86svh, 780px);
  overflow: auto;
  padding: 18px;
}

.settings-sheet header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.settings-sheet header::before {
  content: "";
  display: block;
  width: 58px;
  height: 1px;
}

.settings-sheet header > div {
  grid-column: 2;
}

.settings-sheet header .icon-button {
  grid-column: 3;
}

.settings-section {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.settings-section h3 {
  margin: 0;
  font-size: 1.05rem;
}

.preset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
  width: min(100%, 430px);
}

.preset-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.preset-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  padding: 0 12px;
  outline: 0;
  font-weight: 800;
  text-align: center;
}

.preset-form input:disabled {
  color: rgba(23, 53, 48, 0.48);
  background: rgba(255, 255, 255, 0.46);
  cursor: default;
}

.preset-list {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
  max-height: min(42svh, 430px);
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.preset-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 70px 70px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.preset-item.is-favorite {
  border-color: rgba(37, 139, 119, 0.24);
  background: linear-gradient(135deg, rgba(219, 250, 238, 0.8), rgba(255, 255, 255, 0.72));
}

.preset-item.is-plus-locked {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  opacity: 0.64;
}

.preset-item.is-plus-locked .preset-star-button,
.preset-item.is-plus-locked .preset-name-input,
.preset-item.is-plus-locked .preset-save-button,
.preset-item.is-plus-locked .preset-delete-button {
  pointer-events: none;
}

.preset-item.is-plus-locked .lock-mark {
  top: -5px;
  right: -5px;
}

.preset-star-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(241, 200, 76, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #c89312;
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.preset-star-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.preset-name-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(37, 139, 119, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 0 10px;
  text-align: center;
  font-weight: 900;
  outline: 0;
}

.preset-name-input:focus-visible,
.preset-form input:focus-visible {
  outline: 3px solid rgba(37, 139, 119, 0.24);
  outline-offset: 2px;
}

.preset-save-button,
.preset-delete-button {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.preset-save-button {
  border: 0;
  background: rgba(37, 139, 119, 0.13);
  color: var(--sand-color-strong);
}

.preset-delete-button {
  border: 1px solid rgba(201, 75, 57, 0.24);
  background: rgba(255, 255, 255, 0.8);
  color: #9d3f34;
}

.preset-delete-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.preset-form .secondary-action.is-plus-locked {
  position: relative;
  border-style: dashed;
  padding-right: 30px;
  color: rgba(23, 53, 48, 0.64);
}

.preset-form .secondary-action.is-plus-locked .lock-mark {
  top: -5px;
  right: -5px;
}

.visual-options {
  display: grid;
  gap: 10px;
  width: min(100%, 560px);
}

.setting-toggle,
.setting-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 139, 119, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(219, 250, 238, 0.68)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.42));
  box-shadow: 0 10px 22px rgba(36, 77, 68, 0.08);
  cursor: pointer;
  text-align: left;
}

.setting-toggle span:first-child,
.setting-select-row span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.setting-toggle strong,
.setting-select-row strong {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.2;
}

.setting-toggle small,
.setting-select-row small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.3;
}

.setting-select-row select {
  min-width: 136px;
  min-height: 42px;
  border: 1px solid rgba(37, 139, 119, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
  outline: 0;
}

.setting-select-row select:focus-visible {
  outline: 3px solid rgba(37, 139, 119, 0.24);
  outline-offset: 2px;
}

.setting-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.setting-toggle.is-disabled {
  cursor: default;
  opacity: 0.58;
}

.toggle-visual {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(23, 53, 48, 0.14);
  box-shadow: inset 0 0 0 1px rgba(23, 53, 48, 0.12);
}

.toggle-visual::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 5px 12px rgba(23, 53, 48, 0.18);
  transition: transform 160ms ease;
}

.setting-toggle input:checked + .toggle-visual {
  background: linear-gradient(135deg, var(--sand-color-strong), var(--sand-color));
}

.setting-toggle input:checked + .toggle-visual::after {
  transform: translateX(22px);
}

.setting-toggle:has(input:focus-visible) {
  outline: 3px solid rgba(37, 139, 119, 0.24);
  outline-offset: 2px;
}

.liflo-link-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 12px;
  width: min(100%, 560px);
  padding: 18px 24px;
  border: 1px solid rgba(37, 139, 119, 0.22);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 92% 8%, rgba(241, 200, 76, 0.28), transparent 7rem),
    linear-gradient(135deg, rgba(219, 250, 238, 0.9), rgba(255, 255, 255, 0.86));
  box-shadow: 0 12px 28px rgba(36, 77, 68, 0.09);
  text-align: left;
}

.liflo-link-visual {
  justify-self: start;
  width: 110px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(36, 77, 68, 0.14));
  transform: translateX(-8px);
}

.liflo-link-copy {
  min-width: 0;
  padding-left: 8px;
}

.liflo-link-logo {
  display: block;
  width: min(124px, 100%);
  height: auto;
  margin-bottom: 8px;
}

.liflo-link-section p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 800;
  word-break: keep-all;
}

.liflo-link {
  display: inline-grid;
  min-height: 42px;
  align-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sand-color-strong), var(--sand-color));
  color: #fff;
  padding: 0 18px;
  font-weight: 900;
  text-decoration: none;
}

@media (min-width: 520px) {
  .sound-sheet .sound-pattern-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .timer-layout {
    gap: 12px;
  }

  .control-band {
    grid-template-columns: 1fr;
  }

  .hourglass-canvas {
    width: min(30vw, 300px, calc(36svh * 520 / 680));
    min-width: 180px;
  }

  .time-readout {
    margin-top: -2px;
    font-size: clamp(3.25rem, 4.6vw, 4.1rem);
  }

  .digit-stepper {
    width: min(100%, 340px);
    gap: 6px;
    padding: 6px;
  }

  .digit-control {
    gap: 3px;
  }

  .digit-control span {
    font-size: 0.68rem;
  }

  .digit-step-button {
    width: 34px;
    height: 28px;
    font-size: 1.08rem;
  }

  .primary-action,
  .secondary-action {
    min-height: 44px;
  }
}

@media (min-width: 700px) and (orientation: portrait) {
  .app-shell {
    width: min(100%, 820px);
    padding-inline: max(34px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  .app-header {
    grid-template-columns: 64px minmax(0, 1fr) 64px;
  }

  .icon-button {
    width: 64px;
    height: 64px;
  }

  .icon-svg {
    width: 31px;
    height: 31px;
  }

  .brand-title-icon-face {
    width: clamp(54px, 7vw, 66px);
  }

  .brand-title-icon-hourglass {
    width: clamp(32px, 4.2vw, 40px);
  }

  .brand-title-text {
    font-size: clamp(1.9rem, 4.2vw, 2.5rem);
  }

  .timer-layout {
    gap: 16px;
    padding-top: 18px;
  }

  .task-strip,
  .timer-stage,
  .side-panel {
    width: min(100%, 700px);
  }

  .transition-summary {
    min-height: 82px;
    grid-template-columns: auto auto minmax(260px, 340px);
    padding: 12px 18px;
  }

  .action-select {
    min-height: 56px;
    font-size: clamp(1.65rem, 4.2vw, 2.25rem);
  }

  .hourglass-canvas {
    width: min(46vw, 360px, calc(38svh * 520 / 680));
    min-width: 290px;
  }

  .time-readout {
    font-size: clamp(4.35rem, 9vw, 5.7rem);
  }

  .digit-stepper,
  .action-bar {
    width: min(100%, 480px);
  }

  .digit-stepper {
    gap: 10px;
    padding: 10px 12px;
  }

  .digit-step-button {
    width: 42px;
    height: 34px;
  }

  .primary-action,
  .secondary-action {
    min-height: 54px;
  }

  .color-row {
    grid-template-columns: repeat(6, 50px);
    width: min(100%, 410px);
    gap: 12px;
  }

  .color-swatch {
    width: 50px;
    height: 50px;
  }

  .sound-dialog {
    width: min(82vw, 640px);
  }

  .sound-sheet {
    padding: 22px;
  }

  .settings-dialog {
    width: min(86vw, 780px);
  }
}

@media (min-width: 980px) and (orientation: landscape) {
  .app-shell {
    width: min(100%, 1160px);
    padding-inline: max(24px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  .timer-layout {
    grid-template-columns: minmax(430px, 1fr) minmax(330px, 0.82fr);
    grid-template-areas:
      "stage task"
      "stage side";
    align-items: center;
    justify-content: center;
    column-gap: clamp(22px, 3vw, 44px);
    row-gap: 16px;
    width: 100%;
    padding-top: 14px;
  }

  .task-strip {
    grid-area: task;
    align-self: end;
    width: min(100%, 440px);
  }

  .timer-stage {
    grid-area: stage;
    align-self: center;
    width: min(100%, 560px);
    padding-top: 0;
  }

  .side-panel {
    grid-area: side;
    align-self: start;
    width: min(100%, 440px);
    margin-top: 0;
  }

  .transition-card {
    padding: 10px;
  }

  .transition-summary {
    grid-template-columns: auto auto minmax(160px, 1fr);
    min-height: 74px;
    gap: 10px;
    padding: 10px 12px;
  }

  .transition-summary strong {
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  }

  .action-select {
    min-height: 50px;
    font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  }

  .hourglass-canvas {
    width: min(32vw, 350px, calc(45svh * 520 / 680));
    min-width: 270px;
  }

  .time-readout {
    margin-top: -3px;
    font-size: clamp(4rem, 5.7vw, 5.15rem);
  }

  .digit-stepper {
    width: min(100%, 440px);
    margin-top: 16px;
    gap: 8px;
    padding: 8px 10px;
  }

  .digit-control span {
    font-size: 0.72rem;
  }

  .digit-step-button {
    width: 38px;
    height: 31px;
  }

  .action-bar {
    width: min(100%, 440px);
    margin-top: 24px;
  }

  .control-band {
    width: min(100%, 440px);
    padding-bottom: 0;
  }

  .color-row {
    grid-template-columns: repeat(4, 48px);
    width: min(100%, 252px);
    gap: 12px;
  }

  .color-swatch {
    width: 48px;
    height: 48px;
  }

  .custom-color-panel {
    width: min(100%, 420px);
  }

  .app-footer {
    padding-top: 12px;
  }

  .sound-dialog {
    width: min(78vw, 680px);
  }

  .sound-sheet {
    padding: 22px;
  }

  .sound-sheet .sound-pattern-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .settings-dialog {
    width: min(82vw, 820px);
  }
}

@media (max-width: 620px) {
  .timer-layout {
    gap: 10px;
  }

  .hourglass-canvas {
    width: min(70vw, 286px, calc(40svh * 520 / 680));
    min-width: 220px;
  }

  .time-readout {
    margin-top: -4px;
  }

  .digit-stepper {
    width: min(100%, 340px);
    gap: 6px;
    padding: 7px;
  }

  .digit-step-button {
    width: 34px;
    height: 30px;
  }

  .sound-pattern-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sound-pattern-button {
    min-height: 40px;
    font-size: 0.86rem;
  }

  .custom-color-presets {
    grid-template-columns: repeat(5, 28px);
  }

  .preset-form {
    grid-template-columns: 1fr;
  }

  .preset-item {
    grid-template-columns: 38px minmax(0, 1fr) 58px 58px;
    gap: 6px;
    padding: 7px;
  }

  .preset-star-button {
    width: 38px;
    height: 38px;
  }

  .preset-save-button,
  .preset-delete-button {
    min-height: 38px;
    font-size: 0.86rem;
  }

  .setting-select-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .setting-select-row select {
    width: 100%;
  }

  .liflo-link-section {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 8px;
    padding: 16px 18px;
  }

  .liflo-link-visual {
    width: 84px;
    height: 92px;
    transform: translateX(-5px);
  }

  .liflo-link-copy {
    padding-left: 6px;
  }

  .liflo-link-logo {
    width: min(112px, 100%);
  }
}

@media (max-width: 380px) {
  .app-header {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
  }

  .brand-lockup {
    gap: 4px;
  }

  .brand-title-icon-face {
    width: 34px;
  }

  .brand-title-icon-hourglass {
    width: 21px;
  }

  .brand-title-text {
    font-size: 1.08rem;
  }

  .icon-button {
    width: 54px;
    height: 54px;
  }

  .icon-svg {
    width: 27px;
    height: 27px;
  }

  .task-strip {
    display: block;
  }

  .liflo-link-section {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 6px;
    padding: 15px 16px;
  }

  .liflo-link-visual {
    width: 74px;
    height: 82px;
    transform: translateX(-3px);
  }

  .liflo-link-copy {
    padding-left: 4px;
  }

  .liflo-link-logo {
    width: min(104px, 100%);
  }

  .transition-summary {
    grid-template-columns: auto auto minmax(108px, 1fr);
    gap: 6px;
    padding: 10px;
  }

  .action-select {
    min-height: 44px;
    padding-left: 10px;
    padding-right: 28px;
  }

  .color-row {
    grid-template-columns: repeat(6, 40px);
    width: min(100%, 320px);
    gap: 8px;
  }

  .color-swatch {
    width: 40px;
    height: 40px;
  }
}
