:root {
  --bg: #141414;
  --surface: #1F1F1F;
  --surface-2: #2A2A2A;
  --line: #2E2E2E;
  --border: #4A4A4A;
  --text: #F5F5F5;
  --muted: #A3A3A3;
  --accent: #FF8A3D;
  --on-accent: #141414;
  --accent-soft: #2A1D14;
  --accent-line: #5A3A22;
  --head: #7A4520;
  --brand-dot: #7BC67E;
  --ok-bg: #1E2A1E;
  --ok-text: #A8DCAA;
  --danger: #FF8A80;
  --radius: 20px;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #141414; } }
:root[data-theme="dark"] { --bg: #141414; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--text); }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

.screen {
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(env(safe-area-inset-bottom, 0px) + 112px);
  display: flex; flex-direction: column; gap: 16px;
}
.screen.with-foot { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 110px); }
.screen.plain { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px); }

.top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.logo { display: flex; align-items: baseline; gap: 2px; font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.logo i { width: 6px; height: 6px; border-radius: 3px; background: var(--brand-dot); display: inline-block; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); flex-shrink: 0;
}
.iconbtn.bare { background: transparent; }
.backbar { display: flex; align-items: center; gap: 6px; margin-left: -10px; }
.backbar h1 { font-size: 20px; font-weight: 700; }
.backbar .sub { font-size: 13px; color: var(--muted); }

.hello .date { font-size: 14px; color: var(--muted); }
.hello h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.6px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 17px; font-weight: 600; }
.card.warm { background: var(--accent-soft); border: 1px solid var(--accent-line); }
.card.flat { padding: 4px 16px; gap: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 600; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.6px; color: var(--muted); text-transform: uppercase; }
.divider { height: 1px; background: var(--line); }
.warmtext { color: #D4C4B8; }

.rrow {
  display: flex; align-items: center; gap: 12px; min-height: 48px; width: 100%;
  background: none; border: none; padding: 4px 0; text-align: left;
}
.check {
  width: 30px; height: 30px; border-radius: 15px; border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--on-accent);
}
.check.on { background: var(--accent); border-color: var(--accent); }
.rtext { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.rname { font-size: 15px; font-weight: 600; }
.rsub { font-size: 13px; color: var(--muted); }

.btn {
  min-height: 48px; border-radius: 24px; padding: 0 18px; border: 1px solid var(--border);
  background: transparent; color: var(--text); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.soft { background: var(--surface-2); border-color: var(--surface-2); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #6B3A36; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.linkbtn { background: none; border: none; padding: 8px 0; color: var(--muted); font-size: 13px; text-decoration: underline; align-self: flex-start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.opt {
  min-height: 48px; border-radius: 14px; border: 1px solid #333; background: var(--surface);
  color: var(--text); font-weight: 500; font-size: 14px; padding: 6px 8px;
}
.opt[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.scale button { height: 42px; border-radius: 10px; border: 1px solid #333; background: var(--surface); font-weight: 600; font-size: 13px; padding: 0; }
.scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #333; background: var(--surface);
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.chip.time { min-height: 34px; padding: 0 6px 0 12px; font-size: 13px; background: var(--surface-2); border-color: var(--surface-2); }
.chip.time button { width: 28px; height: 28px; border-radius: 14px; border: none; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }

section.q { display: flex; flex-direction: column; gap: 12px; }
section.q h2 { font-size: 16px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid #3A3A3A; background: var(--surface);
  color: var(--text); padding: 12px 14px; font-size: 15px;
}
textarea.input { resize: vertical; min-height: 88px; }
input[type="time"].input, input[type="date"].input { min-height: 44px; padding: 8px 12px; }
.btn.nowrap { white-space: nowrap; padding: 0 10px; font-size: 14px; }
.timeinput { width: 128px; min-height: 40px; border-radius: 10px; border: none; background: var(--surface-2); color: var(--text); padding: 6px 10px; font-weight: 600; font-size: 15px; }
.checkline { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.checkline input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }

.switch {
  width: 52px; height: 32px; border-radius: 16px; border: none; padding: 3px; background: #3A3A3A;
  display: inline-flex; justify-content: flex-start; flex-shrink: 0; transition: background .15s;
}
.switch span { width: 26px; height: 26px; border-radius: 13px; background: #fff; display: block; }
.switch[aria-pressed="true"] { background: var(--accent); justify-content: flex-end; }
.remrow { display: flex; align-items: center; gap: 10px; min-height: 70px; border-bottom: 1px solid var(--line); }
.remrow:last-child { border-bottom: none; }

.segs { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; }
.segs i { height: 8px; border-radius: 4px; background: #333; display: block; }
.segs i.on { background: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; font-weight: 700; }
.stat span { font-size: 13px; color: var(--muted); }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini b { font-size: 22px; font-weight: 700; display: block; }
.mini span { font-size: 12px; color: var(--muted); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .wd { font-size: 11px; color: var(--muted); text-align: center; }
.cell {
  height: 40px; border-radius: 9px; border: none; display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: transparent; color: var(--text); padding: 0;
}
.cell.none { background: #2E2E2E; }
.cell.head { background: var(--head); color: #fff; font-weight: 600; }
.cell.mig { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cell.miss { border: 1px dashed #707070; color: var(--muted); }
.cell.fut { color: #707070; cursor: default; }
.cell.today { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

.list a, .list .item { display: flex; align-items: center; gap: 12px; min-height: 64px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.list > :last-child { border-bottom: none; }
.badge { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); flex-shrink: 0; }

.banner { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.banner .t { flex: 1; font-size: 14px; }
.banner.alert { background: #3A2620; }

.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 20;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 10px); background: rgba(26, 26, 26, 0.96);
  border-top: 1px solid #262626; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); text-decoration: none; min-height: 48px; justify-content: center; }
.nav a.on { color: var(--accent); }
.nav a.fab { justify-self: center; width: 54px; height: 54px; min-height: 54px; border-radius: 27px; background: var(--accent); color: var(--on-accent); }

.foot {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 20;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 16px); background: rgba(20, 20, 20, 0.97); border-top: 1px solid #262626;
}

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); transform: translateX(-50%) translateY(20px);
  background: #F5F5F5; color: #141414; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500;
  max-width: calc(100% - 40px); width: max-content; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.ob { min-height: 100vh; min-height: 100dvh; padding: calc(env(safe-area-inset-top, 0px) + 40px) 24px calc(env(safe-area-inset-bottom, 0px) + 28px); display: flex; flex-direction: column; gap: 20px; }
.ob h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15; }
.ob p { color: var(--muted); font-size: 16px; line-height: 1.5; }
.ob .grow { flex: 1; }
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: #3A3A3A; display: block; }
.dots i.on { background: var(--accent); width: 22px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.feature b { display: block; font-size: 15px; }
.feature span { font-size: 14px; color: var(--muted); }
.video { position: relative; border-radius: 18px; overflow: hidden; background: var(--surface); aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.video .play { position: relative; width: 64px; height: 64px; border-radius: 32px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.logo-img { display: block; width: auto; max-width: 100%; align-self: flex-start; flex: none; object-fit: contain; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.videobox { border-radius: 16px; overflow: hidden; background: #000; max-width: 100%; }
.videobox video { display: block; width: 100%; max-height: 62vh; aspect-ratio: 3 / 4; object-fit: contain; background: #000; }
