:root {
  color-scheme: dark;
  --ink: #f4f4f5;
  --muted: #8f9098;
  --subtle: #54555d;
  --surface: rgba(26, 27, 32, 0.72);
  --surface-strong: #1d1e23;
  --line: rgba(255, 255, 255, 0.09);
  --green: #b9f36c;
  --green-soft: rgba(185, 243, 108, 0.14);
  --orange: #ffb769;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #050506; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 17%, rgba(71, 72, 84, 0.25), transparent 31rem),
    #050506;
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 28px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.app-header { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 2px solid var(--green);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(185, 243, 108, 0.13);
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 13px;
  width: 9px;
  height: 5px;
  border-radius: 4px 4px 1px 1px;
  background: var(--green);
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 15px;
  width: 4px;
  height: 12px;
  border-radius: 4px;
  background: var(--green);
  transform-origin: 50% 10px;
  transform: rotate(32deg);
}

.brand-mark__hand {
  position: absolute;
  top: 18px;
  left: 17px;
  width: 8px;
  height: 4px;
  border-radius: 4px;
  background: var(--green);
  transform: rotate(12deg);
}

.eyebrow, h1, .display-label, .status-message, .app-footer { margin: 0; }
.eyebrow { color: var(--muted); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
h1 { margin-top: 1px; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.035em; }

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.connection-status__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

.stopwatch {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 450px;
  padding: 42px 0 30px;
}

.display-label { color: var(--subtle); font-size: 0.67rem; font-weight: 700; letter-spacing: 0.16em; text-align: center; text-transform: uppercase; }

.time-display {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin-top: 18px;
  color: var(--ink);
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.time-display__major { font-size: clamp(4rem, 18vw, 6.4rem); font-weight: 400; letter-spacing: inherit; }
.time-display__minor { color: var(--orange); font-size: clamp(4rem, 18vw, 6.4rem); font-weight: 400; letter-spacing: inherit; }
.time-display__separator { margin: 0 0.08em; color: #70717a; font-size: clamp(3.3rem, 15vw, 5.4rem); letter-spacing: -0.05em; }
.time-display__separator--small { margin: 0 0.06em; color: #55565f; font-size: clamp(2.7rem, 12vw, 4.2rem); }

.display-rule { height: 1px; margin: 28px auto 0; width: min(100%, 290px); background: var(--line); }
.display-rule span { display: block; width: 30%; height: 1px; margin: 0 auto; background: var(--green); box-shadow: 0 0 14px var(--green); }
.status-message { min-height: 1.25em; margin-top: 17px; color: var(--muted); font-size: 0.78rem; text-align: center; }

.controls { display: flex; align-items: center; justify-content: center; gap: clamp(28px, 10vw, 58px); }

.control-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 72px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.control-button:hover { color: var(--ink); }
.control-button:active { transform: scale(0.94); }
.control-button:focus-visible { outline: 2px solid var(--green); outline-offset: 7px; border-radius: 50%; }

.control-button__icon {
  position: relative;
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, 0.22);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.control-button:hover .control-button__icon { background: #25262c; }
.control-button--start { color: var(--green); }
.control-button--start .control-button__icon { background: var(--green-soft); box-shadow: inset 0 0 0 1px rgba(185, 243, 108, 0.34), 0 0 26px rgba(185, 243, 108, 0.08); }
.control-button--start:hover .control-button__icon { background: rgba(185, 243, 108, 0.2); }
.control-button__icon--play::after { content: ""; position: absolute; top: 23px; left: 28px; border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-left: 16px solid currentColor; }
.control-button__icon--pause::before, .control-button__icon--pause::after { content: ""; position: absolute; top: 22px; width: 6px; height: 24px; border-radius: 3px; background: currentColor; }
.control-button__icon--pause::before { left: 25px; }
.control-button__icon--pause::after { right: 25px; }
.control-button__icon--reset::before { content: "↻"; position: absolute; inset: 0; display: grid; place-items: center; color: currentColor; font-family: Arial, sans-serif; font-size: 35px; font-weight: 400; line-height: 1; }
.control-button__icon--reset::after { content: none; }
.control-button > span:last-child { font-size: 0.73rem; font-weight: 600; }

.app-footer { display: flex; align-items: center; justify-content: center; gap: 11px; padding-top: 30px; color: var(--subtle); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.04em; }
.footer-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--subtle); }

@media (max-width: 390px) {
  .app-shell { padding-left: 20px; padding-right: 20px; }
  .stopwatch { min-height: 400px; }
  .time-display__major, .time-display__minor { font-size: clamp(3.5rem, 17vw, 5rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
