/* App shell on top of the Home HQ look: header, bottom bar, big brain dump button, sheets. */
[hidden] { display: none !important; }
html { overflow-y: auto; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
a { color: var(--sky); }

/* Header */
.apptop { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); }
.apptop-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 10px 6px; }
.apptop .hello { text-decoration: none; color: var(--fg); display: flex; align-items: center; gap: 10px; }
.apptop .house { width: 38px; height: 38px; }
.apptop h1 { font-size: 24px; font-weight: 700; white-space: nowrap; }
.apptop .hello { flex-shrink: 0; }
@media (max-width: 420px) { .apptop-in { gap: 6px; } .apptop .hello { gap: 6px; } .apptop h1 { font-size: 22px; } .topchips { gap: 4px; } .pchip { padding: 6px 8px; } }
.topchips { display: flex; gap: 6px; align-items: center; }
.pchip { font: 800 14px var(--body); padding: 6px 11px; border-radius: 99px; background: var(--surface); border: 2px solid var(--line); color: var(--fg); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.pchip.gear { padding: 6px 9px; }
.offline-dot { display: none; font-size: 13px; font-weight: 700; color: var(--warn); padding-bottom: 6px; }
html.offline .offline-dot { display: block; }

/* Main area leaves room for the bottom bar */
.appmain { display: grid; gap: 16px; padding-block: 6px calc(110px + env(safe-area-inset-bottom, 0px)); max-width: 760px; }
.appmain h2 { font-size: 22px; }

/* Bottom bar */
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.bnav a { position: relative; display: grid; justify-items: center; gap: 1px; text-decoration: none; color: var(--muted); font: 800 11.5px var(--body); padding: 4px 0; border-radius: 12px; }
.bnav a .ic { font-size: 22px; line-height: 1.1; filter: grayscale(.6); }
.bnav a[aria-current="page"] { color: var(--fg); background: var(--sky-tint); }
.bnav a[aria-current="page"] .ic { filter: none; }
.bnav .n { position: absolute; top: 0; right: 18%; font: 800 11px var(--body); font-style: normal; min-width: 18px; line-height: 18px; border-radius: 9px; background: var(--bad); color: #fff; text-align: center; padding: 0 4px; }
.bnav .n[hidden] { display: none; }
.bdump { order: 0; justify-self: center; width: 66px; height: 66px; margin-top: -28px; border-radius: 50%; padding: 0; display: grid; place-items: center; font-size: 32px; background: var(--sun); border: 4px solid var(--surface); color: var(--sun-ink); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.bdump:hover { border-color: var(--surface); filter: brightness(1.05); }
@media (min-width: 900px) {
  .bnav { left: 50%; right: auto; transform: translateX(-50%); width: 560px; bottom: 14px; border: 1px solid var(--line); border-radius: 22px; padding-bottom: 6px; }
}

/* Pairing screen */
.pairscreen { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.paircard { width: min(420px, 100%); padding: 24px 8px 8px; display: grid; justify-items: center; text-align: center; gap: 8px; }
.house.big { width: 72px; height: 72px; }
.paircard h1 { font-size: 34px; }
#in-code { letter-spacing: 4px; text-transform: uppercase; }

/* Install bar */
.installbar { position: sticky; top: 0; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: var(--sun); color: var(--sun-ink); font-weight: 800; }
.installbar span { flex: 1 1 200px; }

/* Bottom sheets (dialogs) */
dialog.sheet { border: 0; padding: 0; background: transparent; width: min(620px, 100%); max-width: none; max-height: 92dvh; margin: auto auto 0; color: var(--fg); }
@media (min-width: 700px) { dialog.sheet { margin: auto; } }
dialog.sheet::backdrop { background: rgba(0,0,0,.5); }
.sheet-in { background: var(--surface); border-radius: 22px 22px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; max-height: 92dvh; overflow-y: auto; }
@media (min-width: 700px) { .sheet-in { border-radius: 22px; } }
.sheet-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-h h3 { font-size: 22px; }
.x { border: 0; background: transparent; font-size: 22px; padding: 2px 8px; color: var(--muted); }

/* Brain dump */
.mic { justify-self: center; width: 132px; height: 132px; border-radius: 50%; font-size: 54px; padding: 0; display: grid; place-items: center; background: var(--sky); border: 6px solid var(--sky-tint); color: #fff; }
.mic.rec { background: var(--bad); border-color: var(--bad-tint); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .mic.rec { animation: none; } }
.miclabel { text-align: center; font-weight: 800; font-size: 17px; }
.dumptext { font: inherit; font-size: 17px; width: 100%; min-height: 110px; resize: vertical; padding: 12px; border: 2px solid var(--line); background: var(--soft); color: var(--fg); border-radius: 14px; }
.dumpbtns { display: flex; gap: 8px; }
.dumpbtns button { flex: 1; justify-content: center; font-size: 17px; padding: 12px; }
.sorting { text-align: center; font-weight: 800; padding: 22px 0; }
.sorting .spin { font-size: 40px; display: block; animation: wob 1s ease-in-out infinite; }
@keyframes wob { 50% { transform: rotate(12deg) scale(1.1); } }
.summary { font-family: var(--display); font-size: 22px; font-weight: 600; text-align: center; }
.rcards { display: grid; gap: 8px; }
.rcard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--soft); border-left: 6px solid var(--a, var(--sky)); }
.rcard .ri { font-size: 22px; }
.rcard .rt { font-weight: 800; overflow-wrap: anywhere; }
.rcard .rs { font-size: 13px; color: var(--muted); }
.rcard .chk2 { font-size: 12px; font-weight: 800; color: var(--warn); }
.rcard .bin { border: 0; background: transparent; font-size: 20px; padding: 6px; }
.rcard input, .rcard select { font: inherit; font-weight: 700; width: 100%; padding: 6px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); }

/* Today */
.onething { padding: 18px; display: grid; gap: 12px; border: 3px solid var(--sun); }
.onething .lab { font: 800 12px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.onething .big { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.onething .step1 { font-size: 16px; background: var(--soft); border-radius: 12px; padding: 8px 12px; }
.onething .row { display: flex; flex-wrap: wrap; gap: 8px; }
.onething .row button { flex: 1 1 auto; justify-content: center; font-size: 16px; padding: 11px 14px; }
.bigdone { background: var(--ok); border-color: var(--ok); color: #fff; }
.redbar { background: var(--bad); color: #fff; border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; }
.redbar b { font-family: var(--display); font-size: 20px; font-weight: 600; }
.redbar .row { display: flex; flex-wrap: wrap; gap: 8px; }
.redbar button { background: #fff; color: var(--bad); border-color: #fff; }
html.red .apptop { background: var(--bad-tint); }
html.red body { background: var(--bad-tint); }
.wins { display: grid; gap: 0; }
.win { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); }
.win:first-child { border-top: 0; }
.win .wt { font-weight: 700; overflow-wrap: anywhere; }
.win.done .wt { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; text-decoration: none; color: var(--fg); min-width: 0; }
.tile .tl { font: 800 12px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tile .tv { font-weight: 800; overflow-wrap: anywhere; }
.tile .ts { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.jar { padding: 14px 16px; display: grid; gap: 8px; }
.jarbar { height: 16px; border-radius: 99px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.jarbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), #ff9f1c); border-radius: 99px; transition: width .6s; }
.checkin { padding: 14px 16px; display: grid; gap: 10px; border: 2px dashed var(--sky); }
.checkin .row { display: flex; flex-wrap: wrap; gap: 8px; }
.links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.links a { text-align: center; justify-content: center; font-size: 13px; padding: 10px 6px; border-radius: 14px; flex-direction: column; gap: 2px; }
.links a span { font-size: 22px; }

/* Focus timer */
.timer { justify-self: center; position: relative; width: 220px; height: 220px; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .tleft { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 44px; font-weight: 600; }
.trow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Rewards */
.shopitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.mystery { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 10px 0; }
.mystery .box { font-size: 84px; animation: shake .5s ease-in-out 3; }
@keyframes shake { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; width: 100%; height: 100%; }

/* Settings */
.set { display: grid; gap: 0; }
.setrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.setrow:first-child { border-top: 0; }
.setrow .sl { font-weight: 800; }
.setrow .ss { font-size: 13px; color: var(--muted); }
.setrow input[type="time"], .setrow input[type="text"], .setrow input[type="number"], .setrow select { font: inherit; padding: 6px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); max-width: 160px; }
.bigcode { font: 700 34px var(--display); letter-spacing: 4px; text-align: center; background: var(--soft); border-radius: 14px; padding: 12px; user-select: all; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 99px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 12px; }
.seg button[aria-pressed="true"] { background: var(--sun); color: var(--sun-ink); }
.pill { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); }
.mweek .mlab { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; font-size: 15px; margin-bottom: 6px; }
.qrbox { justify-self: center; width: 220px; max-width: 70vw; background: #fff; border-radius: 14px; padding: 8px; }
.qrbox svg { width: 100%; height: auto; display: block; }
