.timer-app {
  min-height: 100vh;
  background: var(--t2t-stage-bg);
  overflow: hidden;
}

.timer-shell {
  position: relative;
  height: calc(100vh - 78px);
  min-height: 0;
  padding: 10px 24px 24px;
}

.timer-card {
  width: min(1500px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: clamp(20px, 2.4vw, 34px);
  background: var(--t2t-cream);
  border-radius: 30px;
  border: 2px solid rgba(36,22,64,.12);
  box-shadow: 0 14px 0 rgba(36,22,64,.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.timer-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex: 0 0 auto;
}

.eyebrow {
  color: #7046c6;
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: .13em;
  margin: 0 0 10px;
}

.timer-card h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: .98;
  color: var(--t2t-ink);
}

.intro {
  margin: 14px 0 0;
  color: var(--t2t-ink-soft);
  font-size: clamp(.95rem, 1.5vw, 1.15rem);
}

.status-box {
  min-width: 220px;
  min-height: 84px;
  padding: 14px 20px;
  border-radius: 18px;
  border: 2px solid #d8ccea;
  background: #fff;
  box-shadow: 5px 5px 0 #ded7e8;
  text-align: center;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.status-box__label {
  display: block;
  color: #7046c6;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
  margin-bottom: 6px;
}

.status-box strong {
  color: var(--t2t-ink);
  font-size: 1.05rem;
}

.timer-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.1vw, 16px);
  margin-top: 18px;
  align-items: stretch;
}

.timer-grid.timer-grid--one {
  grid-template-columns: minmax(0, 820px);
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
}

.timer-grid.timer-grid--three {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.timer-grid.timer-grid--four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.timer-tile {
  min-width: 0;
  min-height: 0;
  border: 2px solid #ddd4c7;
  border-radius: 20px;
  background: #fff;
  box-shadow: 4px 4px 0 #ded7ca;
  padding: 11px 14px 9px;
  display: grid;
  grid-template-rows: 32px minmax(64px, 1fr) 46px 18px;
  gap: 5px;
  overflow: hidden;
  box-sizing: border-box;
}

.timer-tile.is-running {
  border-color: var(--t2t-teal);
  box-shadow: 4px 4px 0 #19b9a5;
}

.timer-tile.is-finished {
  border-color: var(--t2t-coral);
  box-shadow: 4px 4px 0 #d9485e;
}

.timer-tile__head {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
}

.timer-tile__title {
  min-width: 0;
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.25rem);
  line-height: 1;
  font-weight: 900;
}

.key-badge {
  flex: 0 0 auto;
  max-width: 58%;
  padding: 6px 9px;
  border-radius: 9px;
  background: var(--t2t-ink);
  color: #fff;
  font-weight: 900;
  font-size: .74rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-display {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: var(--t2t-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: clamp(2.15rem, 5.2vw, 5rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
}

.timer-tile__controls {
  width: 100%;
  min-width: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin: 0 auto;
  box-sizing: border-box;
}

.tile-btn {
  width: 120px;
  min-width: 0;
  height: 40px;
  padding: 7px 12px;
  border: 2px solid var(--t2t-ink);
  border-radius: 999px;
  background: var(--t2t-teal);
  color: var(--t2t-ink);
  box-shadow: 3px 3px 0 rgba(36,22,64,.2);
  font-weight: 900;
  font-size: .9rem;
  box-sizing: border-box;
}

.tile-btn.stop { background: var(--t2t-coral); }
.tile-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(36,22,64,.2); }
.tile-btn:disabled { background: #eee9df; color: #9b958b; border-color: #cfc8bd; box-shadow: none; }

.timer-tile__hint {
  width: 100%;
  min-width: 0;
  margin: 0;
  text-align: center;
  color: #7a718c;
  font-size: .72rem;
  line-height: 1.1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-grid.timer-grid--one .timer-tile {
  grid-template-rows: 38px minmax(100px, 1fr) 52px 20px;
}

.timer-grid.timer-grid--one .time-display {
  font-size: clamp(3.5rem, 9vw, 7rem);
}

.reset-row {
  flex: 0 0 auto;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}

.reset-btn {
  border: 2px solid var(--t2t-ink);
  border-radius: 999px;
  padding: 11px 24px;
  background: #fff;
  color: var(--t2t-ink);
  box-shadow: 3px 3px 0 rgba(36,22,64,.18);
  font-weight: 900;
}

.reset-btn span { margin-left: 8px; color: #7046c6; }
.message { color: var(--t2t-ink-soft); font-size: .9rem; font-weight: 700; margin: 0; }

.controls-panel {
  position: absolute;
  z-index: 10;
  inset: 18px 50% auto 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  overflow: auto;
  padding: 30px;
  background: var(--t2t-cream);
  border-radius: 28px;
  border: 2px solid #d8ccea;
  box-shadow: 10px 10px 0 rgba(36,22,64,.22);
  box-sizing: border-box;
}

.controls-panel[hidden] { display: none; }
.controls-panel__head { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; margin-bottom:22px; }
.controls-panel h2 { margin:0; font-size:clamp(1.8rem,3vw,2.8rem); }
.controls-done { padding:11px 24px; }
.controls-main { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.field { display:flex; flex-direction:column; gap:7px; font-weight:900; color:var(--t2t-ink); }
.field span { font-size:.92rem; }
.field select, .setting select, .setting input { width:100%; min-height:48px; border:2px solid #d6cfc2; border-radius:12px; background:#fff; color:var(--t2t-ink); padding:9px 12px; font:inherit; font-weight:700; box-sizing:border-box; }
.timer-settings { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:18px; }
.setting { padding:16px; border-radius:16px; background:#f5efe5; border:1px solid #e0d8ca; }
.setting__title { font-weight:900; margin-bottom:10px; }
.setting__row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.setting__row--countdown { grid-template-columns:1fr 1fr; margin-top:10px; }
.setting label { display:flex; flex-direction:column; gap:5px; color:#6e657e; font-size:.78rem; font-weight:800; }
.controls-note { margin-top:18px; padding:14px 16px; border-radius:14px; background:#fff; color:var(--t2t-ink-soft); font-size:.9rem; }

@media (max-height: 760px) and (min-width: 621px) {
  .timer-card { padding: 18px 24px; }
  .timer-card h2 { font-size: clamp(2rem, 3.4vw, 3rem); }
  .intro { margin-top: 7px; font-size: .95rem; }
  .timer-grid { margin-top: 11px; gap: 9px; }
  .timer-tile { padding: 8px 11px 7px; grid-template-rows: 29px minmax(48px, 1fr) 42px 16px; gap: 4px; }
  .time-display { min-height: 48px; font-size: clamp(1.9rem, 4.5vw, 4rem); }
  .timer-tile__controls { height: 42px; }
  .tile-btn { width: 108px; height: 36px; padding: 6px 10px; }
  .timer-tile__hint { font-size: .68rem; }
  .reset-row { min-height: 42px; margin-top: 8px; }
}

@media (max-width: 900px) {
  .timer-shell { padding: 8px 12px 16px; }
  .timer-card { padding: 18px; }
  .timer-card__top { flex-direction: column; gap: 12px; }
  .status-box { width: 100%; min-width: 0; }
  .controls-main, .timer-settings { grid-template-columns: 1fr; }
  .time-display { font-size: clamp(2rem, 7vw, 4.5rem); }
}

@media (max-width: 620px) {
  .timer-app { overflow: auto; }
  .timer-shell { height: auto; min-height: calc(100vh - 78px); }
  .timer-card { height: auto; min-height: calc(100vh - 110px); overflow: visible; }
  .timer-grid, .timer-grid.timer-grid--three, .timer-grid.timer-grid--four { grid-template-columns: 1fr; grid-template-rows: none; overflow: visible; }
  .timer-tile { min-height: 190px; }
  .reset-row { flex-direction: column; gap: 8px; }
  .controls-panel { max-height: calc(100% - 24px); padding: 20px; }
}
