:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #5f6368;
  --line: #e3e6eb;
  --accent: #1a73e8;
  --accent-text: #ffffff;
  --accent-soft: #e8f0fe;
  --danger: #b3261e;
  --ok: #188038;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(60, 64, 67, .12), 0 1px 3px 1px rgba(60, 64, 67, .08);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1c1f24;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --line: #2f333a;
    --accent: #8ab4f8;
    --accent-text: #0b1d3a;
    --accent-soft: #1e2a3d;
    --danger: #f2b8b5;
    --ok: #81c995;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 500;
}

.lang, .link, .quiet {
  font: inherit;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 999px;
  min-height: 44px;
}

.lang:hover, .link:hover { background: var(--accent-soft); }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

h1 { font-size: 28px; font-weight: 400; margin: 16px 0 4px; text-align: center; overflow-wrap: anywhere; }
h2 { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
h3 { font-size: 13px; font-weight: 500; margin: 24px 4px 8px; color: var(--muted); letter-spacing: .02em; }

.lead { color: var(--muted); text-align: center; margin: 0 auto 24px; max-width: 32rem; }

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 16px auto 0;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: var(--accent);
  color: var(--accent-text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  color: inherit;
  text-decoration: none;
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  text-align: start;
  cursor: pointer;
  min-height: 64px;
}

a.tile:hover, button.tile:hover { background: var(--accent-soft); }

.tile + .tile, .row + .row { border-top: 1px solid var(--line); }

.tile .text, .row .text { flex: 1; min-width: 0; }
.tile .title, .row .title { font-weight: 500; overflow-wrap: anywhere; }
.tile .sub, .row .sub { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

.chev { color: var(--muted); font-size: 22px; line-height: 1; }

.icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  min-height: 64px;
  transition: opacity .25s ease, transform .25s ease;
}

.row.leaving { opacity: 0; transform: translateX(24px); }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ok);
  margin-inline-start: 6px;
}

.stack { display: grid; gap: 12px; max-width: 360px; margin: 0 auto; }

.btn {
  font: inherit;
  font-weight: 500;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 24px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  width: 100%;
}

.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { width: auto; min-height: 40px; padding: 0 16px; }

.field { display: grid; gap: 6px; text-align: start; }
.field span { font-size: 14px; color: var(--muted); }
.field input {
  font: inherit;
  font-size: 17px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.note { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 0; }
.error { color: var(--danger); font-size: 14px; margin: 0; text-align: center; }
.body { margin: 0; padding: 16px 20px; color: var(--muted); }
.body + .body { padding-top: 0; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px -8px;
}

.detail-head { text-align: center; margin-bottom: 8px; }
.detail-head .icon { width: 64px; height: 64px; font-size: 26px; border-radius: 18px; margin: 8px auto 0; }

.quiet-zone { text-align: center; margin-top: 56px; }
.quiet {
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
}

.danger { color: var(--danger); }

.foot {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}
.foot a { color: var(--muted); }
.foot p { flex-basis: 100%; text-align: center; margin: 4px 0 0; overflow-wrap: anywhere; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 12px;
  max-width: calc(100% - 32px);
  z-index: 30;
  animation: rise .2s ease;
}

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 10; animation: fade .2s ease; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px max(20px, env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  max-width: 560px;
  margin: 0 auto;
  animation: up .22s ease;
}
.sheet h2 { margin-bottom: 8px; overflow-wrap: anywhere; }
.sheet p { color: var(--muted); margin: 0 0 16px; }
.sheet .actions { display: grid; gap: 8px; margin-top: 8px; }

@media (min-width: 600px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; left: 16px; right: 16px; animation: fade .2s ease; }
}

.spinner { text-align: center; color: var(--muted); padding: 48px 0; }

@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.row.keeps { align-items: flex-start; }
.details { margin: 6px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 14px; }
.details li + li { margin-top: 6px; }

.banner {
  margin: 0 0 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  animation: up .35s cubic-bezier(.2, .8, .2, 1);
  transition: opacity .25s ease, transform .25s ease;
}
.banner-title { margin: 0 0 4px; font-weight: 600; }
.banner .body { margin: 0 0 12px; }
.banner .days { font-variant-numeric: tabular-nums; font-size: 1.15em; }
.banner .actions { display: flex; }
.banner.leaving { opacity: 0; transform: translateY(-8px) scale(.98); }
.banner.shake { animation: shake .35s ease; }
.lang-mount { margin-inline-start: auto; }
.btn:active { transform: scale(.97); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
