:root {
  --bg:#f6f6f7; --card:#fff; --ink:#1f2937; --muted:#6b7280;
  --line:#e5e7eb; --go:#16a34a; --go-soft:#dcfce7; --accent:#1f2937;
}
* { box-sizing:border-box; font-style:normal; }
body { margin:0; background:var(--bg); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased; line-height:1.4; }
.wrap { max-width:440px; margin:0 auto; padding:20px 16px 40px; }
.appwrap { max-width:460px; padding-bottom:96px; }
#tab-me .card, #tab-message .card { max-width:460px; }
h1 { font-size:24px; margin:4px 0 2px; letter-spacing:-0.01em; line-height:1.2; }
.titlemoji { display:block; margin-top:6px; font-size:26px; letter-spacing:2px; }
.sub { color:var(--muted); font-size:14px; margin:0 0 18px; }
.hint { font-weight:500; color:var(--muted); }
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; margin-bottom:16px; }
label { display:block; font-weight:600; font-size:14px; margin-bottom:10px; }
.claim-l { margin-top:18px; }
input[type=text], input[type=tel] { width:100%; padding:14px; font-size:17px; border:1px solid var(--line); border-radius:12px; background:#fff; color:var(--ink); }
.last4row { display:flex; gap:10px; }
.last4row input { text-align:center; letter-spacing:4px; }
button.primary { width:100%; margin-top:16px; padding:15px; font-size:17px; font-weight:700; color:#fff; background:var(--accent); border:none; border-radius:12px; cursor:pointer; }
.err { color:#b91c1c; font-size:14px; margin-top:12px; min-height:1px; }

/* roster */
.roster { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.rtile { padding:16px; font-size:17px; font-weight:700; text-align:center; border:1.5px solid var(--line); background:#fff; color:var(--ink); border-radius:14px; cursor:pointer; }
.rtile.sel { border-color:var(--accent); background:#f3f4f6; }
.rtile .joined { display:block; font-size:11px; font-weight:600; color:var(--go); margin-top:2px; }

/* emoji grid 7x7 */
.emojigrid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.eg { aspect-ratio:1; font-size:20px; border:1px solid var(--line); background:#fff; border-radius:10px; cursor:pointer; padding:0; display:flex; align-items:center; justify-content:center; }
.eg.sel { border-color:var(--go); background:var(--go-soft); }
.eg.taken { opacity:.28; cursor:not-allowed; }

/* banner + calendar */
.banner { background:var(--accent); color:#fff; border-radius:16px; padding:16px; margin-bottom:16px; font-size:16px; }
.banner b { font-weight:700; }
.banner.empty { background:#eef0f2; color:var(--muted); font-weight:500; }
.daylist { display:grid; gap:8px; }
.day { display:flex; align-items:center; gap:10px; width:100%; text-align:left; font:inherit; color:var(--ink);
  padding:13px 14px; border:1.5px solid var(--line); background:#fff; border-radius:12px; cursor:pointer; }
.day.best { border-color:var(--go); }
.day .d-label { font-weight:600; flex:1; }
.day .fire { margin-left:4px; }
.day .d-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.day .pchip { font-size:12px; font-weight:600; padding:3px 8px; border-radius:999px; background:#eceef1; color:#4b5563; }
.day .d-set { font-size:13px; color:var(--muted); }
.day .d-others { font-size:12px; color:var(--muted); }
.more { width:100%; margin-top:10px; padding:11px; font-size:14px; font-weight:600; color:var(--muted); background:none; border:none; text-decoration:underline; cursor:pointer; }

/* me */
.meprofile { text-align:center; padding:8px 0 4px; }
.meprofile .me-emoji { font-size:48px; }
.meprofile .me-name { font-size:22px; font-weight:700; margin-top:6px; }

/* feedback */
textarea { width:100%; padding:12px 14px; font-size:15px; border:1px solid var(--line); border-radius:12px; resize:vertical; font-family:inherit; color:var(--ink); }
.fblist { margin-top:14px; display:grid; gap:12px; }
.fbitem { font-size:14px; border-top:1px solid var(--line); padding-top:10px; }
.fbitem:first-child { border-top:none; padding-top:0; }
.fbitem .fbhead { font-weight:600; }
.fbitem .fbmsg { color:#374151; white-space:pre-wrap; margin-top:2px; }
.fbitem .fbtime { color:var(--muted); font-size:12px; margin-top:2px; }
.fbempty { color:var(--muted); font-size:14px; }

/* day modal */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.45); display:flex; align-items:center; justify-content:center; padding:16px; z-index:50; }
.modal-overlay[hidden] { display:none; }
.modal-card { background:var(--card); border-radius:20px; padding:22px 20px 20px; width:100%; max-width:440px; position:relative; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
.modal-x { position:absolute; top:14px; right:14px; width:36px; height:36px; border:none; border-radius:50%; background:#f3f4f6; color:var(--muted); font-size:22px; line-height:1; cursor:pointer; }
.modal-title { font-size:22px; margin:0 0 2px; }
.modal-sub { color:var(--muted); font-size:14px; margin:0 0 16px; }
.parts { margin-bottom:14px; }
.part { display:flex; align-items:center; justify-content:space-between; padding:15px 16px; font-size:16px; font-weight:600; text-align:left;
  border:1.5px solid var(--line); background:#fff; color:var(--ink); border-radius:12px; cursor:pointer; }
.part .pstate { font-size:14px; font-weight:600; color:var(--muted); }
.part.on { border-color:var(--go); background:var(--go-soft); }
.part.on .pstate { color:var(--go); }

/* bottom tab bar */
.tabbar { position:fixed; bottom:0; left:0; right:0; display:flex; background:#161b22;
  border-top:1px solid #0b0e13; padding-bottom:env(safe-area-inset-bottom); z-index:40; }
.tab { flex:1; background:none; border:none; cursor:pointer; padding:9px 0 11px; display:flex; flex-direction:column; align-items:center; gap:2px;
  color:#9aa3af; font-size:11px; font-weight:600; }
.tab .tabicon { font-size:21px; line-height:1; filter:grayscale(0.4) opacity(0.85); }
.tab.active { color:#fff; }
.tab.active .tabicon { filter:none; }
.tab.active[data-tab="meet"] { color:#5ee08a; }

/* offline / reconnecting bar */
.netbar { position:fixed; top:0; left:0; right:0; z-index:60; background:#b91c1c; color:#fff;
  text-align:center; font-size:13px; font-weight:600; padding:8px 12px;
  padding-top:calc(8px + env(safe-area-inset-top)); }
.netbar[hidden] { display:none; }

/* session-ended note on the join screen */
.joinnote { background:#fef3c7; color:#92400e; border:1px solid #fde68a; border-radius:10px;
  padding:11px 13px; font-size:13.5px; font-weight:600; margin-bottom:16px; }
.joinnote[hidden] { display:none; }

/* who else is free — day-row avatars + per-slot "going" list in the modal */
.d-who { font-size:15px; letter-spacing:1px; }
.d-count { font-size:12px; font-weight:700; padding:2px 7px; border-radius:999px; background:rgba(0,0,0,0.07); color:var(--ink); }

/* meet header + Cards/Calendar toggle */
.meethdr { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.meethdr label { margin-bottom:0; }
.viewtoggle { display:inline-flex; background:#eceef1; border-radius:999px; padding:3px; flex:none; }
.viewtoggle button { border:none; background:none; font:inherit; font-size:12px; font-weight:700; color:var(--muted); padding:5px 12px; border-radius:999px; cursor:pointer; }
.viewtoggle button.on { background:#fff; color:var(--ink); box-shadow:0 1px 2px rgba(0,0,0,.14); }
.legend { font-size:12px; line-height:1.45; color:var(--muted); margin:13px 2px 0; }
.updated { font-size:11px; color:#aab0b8; margin:5px 2px 0; }
.dcmeta .slotemoji { font-size:14px; }
.calcell .cslot { position:absolute; bottom:3px; right:6px; font-size:14px; line-height:1; }

/* CARDS view — 2-col chunky day cards */
.cardgrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.daycard { position:relative; min-width:0; border:1.5px solid var(--line); border-radius:15px; background:#fff;
  padding:12px 13px; min-height:80px; display:flex; flex-direction:column; text-align:left; font:inherit; color:var(--ink); cursor:pointer; }
.daycard.today { border-color:var(--ink); border-width:2px; }
.daycard.best { border-color:var(--go); }
.dchead { display:flex; align-items:baseline; gap:7px; }
.dcwd { font-size:12px; font-weight:700; color:var(--muted); }
.daycard.today .dcwd { color:var(--ink); }
.dcdt { font-size:23px; font-weight:800; line-height:1; }
.dcfire { margin-left:auto; font-size:15px; }
.dcmeta { margin-top:auto; display:flex; align-items:center; gap:7px; padding-top:9px; min-width:0; }
.dcmeta .d-who { font-size:14px; letter-spacing:0; white-space:nowrap; overflow:hidden; }
.dcempty { margin-top:auto; padding-top:9px; font-size:12.5px; color:#b3b9c2; font-weight:600; }
.daycard.mine .dcempty { color:var(--go); }

/* CALENDAR view — rolling 3-week grid: cells TOUCH (zero gap), single hairlines, max tap area */
.calhdr { display:grid; grid-template-columns:repeat(7,1fr); margin-bottom:7px; }
.calhdr span { text-align:center; font-size:11px; font-weight:700; color:#9aa3af; }
#days { margin-left:-16px; margin-right:-16px; }
.calgrid { display:grid; grid-template-columns:repeat(7,1fr); border-top:1px solid var(--line); border-left:none; border-right:none; overflow:hidden; }
.calgrid .calcell:nth-child(7n) { border-right:none; }
.calcell { position:relative; min-width:0; min-height:76px; background:#fff; border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font:inherit; color:var(--ink); cursor:pointer; }
.calcell .cn { font-size:16px; font-weight:700; line-height:1; }
.calcell.past { cursor:default; }
.calcell.past .cn { color:#c5cad1; font-weight:500; }
.calcell.today .cn { background:var(--ink); color:#fff; width:27px; height:27px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; }
.calcell .ct { position:absolute; bottom:4px; left:5px; width:18px; height:18px; border-radius:50%; background:#fff; border:1px solid rgba(15,61,35,.22); box-shadow:0 1px 1.5px rgba(0,0,0,.14); display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:800; color:#0f3d23; }
.calcell .medal { position:absolute; top:2px; right:3px; font-size:13px; line-height:1; }
.calcell .mtag { position:absolute; top:3px; left:5px; font-size:8px; font-weight:800; color:var(--go); letter-spacing:.02em; line-height:1; }

/* day popup slots — checkbox = YOU, "also free" = the others */
.slot { display:flex; align-items:flex-start; gap:12px; width:100%; padding:13px 14px; border:1.5px solid var(--line);
  border-radius:13px; background:#fff; margin-bottom:9px; font:inherit; text-align:left; color:var(--ink); cursor:pointer; }
.slot.on { border-color:var(--go); background:#f1fbf4; }
.slot .cb { width:23px; height:23px; border-radius:7px; border:2px solid #cfd4da; flex:none; margin-top:1px;
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:14px; font-weight:900; }
.slot.on .cb { background:var(--go); border-color:var(--go); }
.slot .sbody { flex:1; min-width:0; }
.slot .sname { font-size:16px; font-weight:700; display:block; }
.slot .salso { font-size:13px; font-weight:600; color:#4b5563; margin-top:4px; display:block; }
.partcell { display:flex; flex-direction:column; }
.partwho { font-size:12.5px; font-weight:600; color:var(--muted); margin:6px 2px 0; }

/* DESKTOP / TABLET (>=600px) — keep the calendar WIDE (use the screen) but give
   cells real height so the grid reads as a calendar, not a squished ledger.
   Same light hairlines as mobile. Phones (<600px) never reach this block, so
   the mobile app is untouched. */
@media (min-width: 600px) {
  .appwrap { max-width:960px; }
  #days { margin-left:0; margin-right:0; }
  /* desktop grid lines via gap + bg, NOT cell borders: the 0.5px gray gaps show
     one uniform hairline between cells. With no cell borders, nothing can double
     up or sit adjacent. Mobile keeps its 1px #e5e7eb border grid (frozen). */
  .calgrid { border:none; gap:0.5px; background:gray; }
  .calcell { min-height:120px; border:none; }
}
