:root {
  color-scheme: light;
  --ink: #20302c;
  --muted: #6f7975;
  --paper: #fffdfa;
  --canvas: #f1eee7;
  --green: #315e52;
  --green-dark: #24483f;
  --mint: #dbe8df;
  --line: #e1ddd4;
  --danger: #a33b35;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,.95), transparent 28rem),
    linear-gradient(145deg, var(--canvas), #e8e5dd);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main { width: min(100%, 430px); }

.login-card, .control-card {
  background: rgba(255, 253, 250, .96);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(32, 48, 44, .13), 0 2px 8px rgba(32, 48, 44, .06);
  padding: 32px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--green);
  margin-bottom: 28px;
}

.brand-mark span { width: 24px; height: 13px; border: 2px solid white; border-top: 0; border-radius: 0 0 12px 12px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: .72rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 8vw, 2.55rem); font-weight: 500; letter-spacing: -.035em; }
.intro { color: var(--muted); line-height: 1.55; margin: 12px 0 28px; }
form { display: grid; gap: 9px; }
label { margin-top: 8px; font-size: .84rem; font-weight: 650; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 13px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49, 94, 82, .12); }
#totp { letter-spacing: .24em; font-variant-numeric: tabular-nums; }
button { font: inherit; cursor: pointer; }
.primary {
  border: 0;
  border-radius: 13px;
  background: var(--green);
  color: white;
  font-weight: 700;
  padding: 14px 18px;
  margin-top: 7px;
  transition: background .2s, transform .15s;
}
.primary:hover { background: var(--green-dark); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid rgba(49, 94, 82, .25); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .58; }
.message { min-height: 1.25rem; margin: 7px 0 0; color: var(--green); font-size: .84rem; text-align: center; }
.message.error { color: var(--danger); text-align: left; }

header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.05rem; }
.status-panel { border-radius: 20px; background: #edf2ed; padding: 20px; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .87rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4f806d; box-shadow: 0 0 0 4px rgba(79,128,109,.11); }
.status-dot.loading { animation: pulse 1.4s infinite; }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(163,59,53,.1); }
#position { display: block; margin: 18px 0 12px; font-family: Georgia, serif; font-size: 2.2rem; font-weight: 500; }
.track { height: 6px; overflow: hidden; border-radius: 99px; background: #d3ddd5; }
.track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .45s ease; }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.controls button { min-height: 96px; display: grid; place-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 17px; background: white; color: var(--ink); font-size: .82rem; font-weight: 680; transition: background .2s, border-color .2s, transform .15s; }
.controls button:hover { border-color: #b9c8be; background: #f7faf7; }
.controls .stop { background: var(--green); border-color: var(--green); color: white; }
.controls .stop:hover { background: var(--green-dark); }
.arrow { font-size: 1.5rem; font-weight: 400; line-height: 1; }
.square { font-size: .85rem; line-height: 1.75rem; }
.updated { margin: 14px 0 0; color: #929995; text-align: center; font-size: .72rem; }
[hidden] { display: none !important; }

@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 480px) {
  body { padding: 14px; align-items: center; }
  .login-card, .control-card { padding: 25px 20px; border-radius: 23px; }
  .controls button { min-height: 86px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
