:root {
  --bg: #f7f5ef;
  --surface: #fffdf8;
  --surface-2: #f0f6f4;
  --ink: #25302d;
  --muted: #64706c;
  --line: #d6ded8;
  --brand: #137b6d;
  --brand-dark: #0c5d54;
  --accent: #e0593e;
  --gold: #c59235;
  --shadow: 0 18px 40px rgba(37, 48, 45, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(19, 123, 109, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(19, 123, 109, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1060px, calc(100% - 24px));
  margin: 0 auto;
  padding-bottom: 36px;
}

.site-header {
  padding: 18px 0 8px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 26px;
}

.brand-logo {
  width: 260px;
  height: 64px;
  display: block;
}

.primary-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.primary-tabs a {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 7px 7px 0 0;
}

.primary-tabs a.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.short {
  display: none;
}

h1 {
  margin: 18px 0 0;
  font-size: clamp(32px, 7vw, 58px);
  line-height: 1;
}

h2 {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: clamp(20px, 4vw, 32px);
}

.notice,
.block,
.timer-panel,
.ad-slot,
.timer-card,
.site-footer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  margin: 12px 0;
  padding: 16px;
  text-align: center;
}

.notice h3 {
  margin: 0 0 10px;
}

.notice button,
.timer-form button,
.timer-actions button,
.share-actions button,
.comment-form button {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 800;
}

.notice-ok {
  background: #e6f6ee;
  color: #17603e;
}

.timer-panel {
  padding: 18px;
  text-align: center;
  background: linear-gradient(180deg, #fffdf8, #edf6f1);
}

.display-frame {
  width: min(680px, 100%);
  min-height: 190px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 8px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: #111b18;
  color: #f7fff8;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.time-number {
  display: grid;
  place-items: center;
  min-width: 0;
  font-size: clamp(72px, 20vw, 170px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.time-number + .time-number {
  border-left: 4px solid rgba(255, 255, 255, 0.18);
}

.display-labels {
  width: min(680px, 100%);
  margin: 8px auto 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

#exceededLabel,
#elapsedLabel {
  color: var(--accent);
}

.timer-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.timer-actions button {
  background: var(--brand);
}

.intro {
  text-align: center;
  background: var(--surface-2);
  border-block: 1px solid var(--line);
  padding: 11px;
  margin: 14px 0;
}

.block {
  padding: 16px;
  margin-bottom: 16px;
}

.block h3,
.other-timers > h3 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #dfe8e2;
}

.timer-form {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.timer-form input {
  width: 96px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  font-weight: 800;
  text-align: center;
}

.form-unit {
  margin-left: -4px;
  color: var(--muted);
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.preset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-list button,
.segmented button {
  border: 1px solid #bcd5ce;
  background: #e9f5f1;
  color: var(--brand-dark);
  border-radius: 6px;
  padding: 8px 11px;
  font-weight: 800;
}

.preset-list button:hover,
.segmented button:hover,
.segmented button.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.side-stack {
  display: grid;
  gap: 16px;
}

.option-row {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.volume-row {
  grid-template-columns: 1fr;
}

input[type="range"] {
  accent-color: var(--brand);
  width: 100%;
}

.compact-options .toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-weight: 700;
}

.ad-slot {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #fff7dc;
  border-color: #e7c878;
  text-align: center;
}

.ad-slot span {
  color: #8f6c1f;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ad-slot p {
  margin: 0;
  color: var(--muted);
}

.help-panel p {
  margin: 0;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.share-actions button[aria-label] {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 6px;
  background: var(--brand);
  text-transform: uppercase;
}

.share-actions #showComment {
  width: auto;
  height: auto;
  background: var(--accent);
  text-transform: none;
  padding: 10px 14px;
}

.comment-status {
  color: var(--muted);
  font-size: 13px;
}

.comment-form {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.comment-form label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

.comment-form input,
.comment-form textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}

.comment-form textarea {
  min-height: 90px;
  resize: vertical;
}

.other-timers {
  margin-top: 16px;
}

.timer-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.timer-card {
  padding: 14px;
}

.timer-card h3 {
  margin: 12px 0;
  font-size: 20px;
}

.timer-card p {
  color: var(--muted);
}

.card-image {
  min-height: 132px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 34% 54%, #fff9ed 0 18px, transparent 19px),
    radial-gradient(circle at 48% 50%, #fff1ce 0 22px, transparent 23px),
    linear-gradient(135deg, #d9eee7, #e8d28d);
}

.kitchen-card .card-image {
  background:
    linear-gradient(135deg, transparent 42%, rgba(37, 48, 45, 0.18) 43% 46%, transparent 47%),
    radial-gradient(circle at 54% 60%, #f7f5ef 0 30px, transparent 31px),
    linear-gradient(135deg, #c9e8e1, #f0bb76);
}

.tea-card .card-image {
  background:
    radial-gradient(circle at 48% 48%, #8fc7b8 0 28px, transparent 29px),
    radial-gradient(circle at 58% 55%, transparent 0 30px, #734c35 31px 38px, transparent 39px),
    linear-gradient(135deg, #e2f1eb, #d8c170);
}

.app-icon {
  display: grid;
  place-items: center;
  background:
    conic-gradient(from 0.1turn, #137b6d, #e0593e, #c59235, #137b6d);
}

.rating {
  color: var(--gold);
  font-weight: 800;
}

.features {
  margin: 0;
  padding-left: 20px;
}

.site-footer {
  margin-top: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.site-footer h4 {
  margin: 0 0 10px;
}

.legal-entry {
  margin-top: 14px;
}

.legal-entry button {
  border: 0;
  background: transparent;
  color: #7f8a86;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}

.legal-entry button:hover {
  color: var(--brand-dark);
}

.legal-dialog {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.legal-dialog::backdrop {
  background: rgba(20, 28, 25, 0.35);
}

.legal-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.legal-dialog-header h3 {
  margin: 0;
}

.legal-dialog-header button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 7px 10px;
  font-weight: 700;
}

.legal-dialog-body {
  max-height: min(64vh, 520px);
  overflow: auto;
  padding: 4px 16px 16px;
}

.legal-dialog-body p {
  margin: 12px 0;
  color: var(--muted);
}

.language-list {
  columns: 2;
  margin: 0;
  padding-left: 20px;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .content-grid,
  .site-footer {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 14px, 1060px);
  }

  .site-header {
    padding: 6px 0 2px;
  }

  .long {
    display: none;
  }

  .brand-logo {
    width: 176px;
    height: auto;
  }

  .short {
    display: inline;
  }

  .primary-tabs {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 4px;
    margin-top: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .primary-tabs::-webkit-scrollbar {
    display: none;
  }

  .primary-tabs a {
    flex: 0 0 auto;
    padding: 6px 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  h1 {
    margin-top: 6px;
    font-size: 28px;
  }

  h2 {
    margin-bottom: 6px;
    font-size: 17px;
  }

  #page {
    display: flex;
    flex-direction: column;
  }

  .timer-panel {
    order: 1;
    padding: 10px;
    margin-bottom: 10px;
  }

  .timer-form-block {
    order: 2;
  }

  .content-grid {
    order: 3;
    display: flex;
    flex-direction: column;
  }

  .side-stack {
    display: contents;
  }

  .options-block {
    order: 2;
  }

  .presets-block {
    order: 3;
  }

  .compact-options {
    order: 4;
  }

  .ad-slot {
    order: 1;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 4px 10px;
    margin-bottom: 10px;
    padding: 9px 10px;
    text-align: left;
    box-shadow: none;
    min-height: 58px;
    max-height: 72px;
    overflow: hidden;
  }

  .ad-slot span {
    grid-row: 1 / 3;
    align-self: center;
    font-size: 10px;
    writing-mode: vertical-rl;
  }

  .ad-slot strong {
    font-size: 14px;
    line-height: 1.15;
  }

  .ad-slot p {
    font-size: 12px;
    line-height: 1.25;
  }

  .notice {
    order: 4;
    margin: 6px 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  .notice h3 {
    margin-bottom: 6px;
    font-size: 16px;
  }

  .notice button {
    min-height: 40px;
    padding: 8px 12px;
  }

  .intro {
    order: 5;
    margin: 8px 0;
    padding: 9px;
    font-size: 14px;
  }

  .help-panel {
    order: 6;
  }

  .share-block {
    order: 7;
  }

  .other-timers {
    order: 8;
  }

  .display-frame {
    min-height: 126px;
    border-width: 5px;
  }

  .time-number {
    font-size: clamp(58px, 25vw, 112px);
  }

  .display-labels {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .timer-actions button,
  .preset-list button,
  .segmented button,
  .timer-form button,
  .share-actions #showComment {
    min-height: 44px;
  }

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

  .block {
    padding: 12px;
    margin-bottom: 10px;
  }

  .block h3,
  .other-timers > h3 {
    margin-bottom: 10px;
    padding-bottom: 6px;
    font-size: 17px;
  }

  .timer-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
  }

  .timer-form label {
    min-width: 0;
  }

  .timer-form button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .timer-form input {
    width: 100%;
    min-height: 46px;
    padding: 9px;
  }

  .form-unit {
    align-self: center;
    margin-left: 0;
  }

  .preset-list,
  .segmented,
  .share-actions {
    gap: 7px;
  }

  .preset-list li {
    flex: 1 1 72px;
  }

  .preset-list.compact li {
    flex-basis: 100%;
  }

  .preset-list button {
    width: 100%;
  }

  .legal-dialog {
    width: min(94vw, 560px);
  }

  .legal-dialog-header {
    padding: 12px;
  }

  .legal-dialog-body {
    max-height: 70vh;
    padding: 2px 12px 12px;
  }
}
