:root {
  --bg: #f4f1ec; --surface: #ffffff; --text: #1d1b20; --muted: #6b6670; --line: #e4dfd8;
  --accent: #1d1b20; --accent-text: #ffffff; --danger: #c0392b; --ok-bg: #e8f3ea; --ok-text: #1f5e2e;
  --radius: 18px; --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 30px rgb(0 0 0 / .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16151a; --surface: #211f26; --text: #f2eff5; --muted: #a29ca8; --line: #34313a; --accent: #f2eff5; --accent-text: #16151a; --danger: #ff7b6b; --ok-bg: #1d3524; --ok-text: #a6e3b4; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: inherit; }
h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 15px; margin: 18px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 24px; padding: 32px 24px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.card p { margin: 0; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand h1 { margin: 0; }
.brand .mark { width: 44px; height: 44px; }
.brand.small { gap: 8px; font-weight: 600; }
.brand.small .mark { width: 28px; height: 28px; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: transform .08s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary, .btn.apple { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: 15px; }
.btn.danger { color: var(--danger); }
.btn.busy, .btn:disabled { opacity: .55; pointer-events: none; }
.link { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 4px 6px; }
.link.danger { color: var(--danger); }

.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; min-height: 46px; padding: 0 14px; width: 100%; min-width: 0;
}
input:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.error { color: var(--danger); font-size: 14px; }
.notice { background: var(--ok-bg); color: var(--ok-text); padding: 12px 16px; border-radius: 12px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; max-width: 880px; margin: 0 auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; text-decoration: none; }
.wrap { max-width: 880px; margin: 0 auto; padding: 8px 20px 48px; }
.wrap.narrow { max-width: 620px; }
.hello { font-size: 34px; margin: 12px 0 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface); border-radius: var(--radius); padding: 18px; text-decoration: none; box-shadow: var(--shadow);
  display: grid; gap: 4px; justify-items: start; transition: transform .12s ease;
}
.tile:active { transform: scale(.98); }
.tile img { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 8px; }
.tile-name { font-weight: 700; font-size: 17px; }
.tile-desc { color: var(--muted); font-size: 14px; }
.howto { margin-top: 32px; background: var(--surface); border-radius: var(--radius); padding: 4px 18px; }
.howto summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.howto-body { padding-bottom: 8px; color: var(--muted); font-size: 15px; }
.howto-body b { color: var(--text); }

.panel { background: var(--surface); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.panel > p { margin: 0 0 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.gap { margin-top: 12px; flex-wrap: wrap; }
.list { list-style: none; margin: 8px 0 12px; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li > div:first-child { display: grid; min-width: 0; }
.actions { display: flex; flex-shrink: 0; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); font-weight: 600; }
.invite-result { display: flex; gap: 8px; margin-top: 10px; }
