:root {
  color-scheme: light;
  --paper: #fcf8f2; --ink: #24233c; --muted: #625e75; --purple: #49317f;
  --line: #e9dfec; --white: #fffdfb; --radius: 22px;
  font-family: ui-rounded, "Avenir Next", system-ui, sans-serif;
  color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button, select { border: 1px solid var(--line); background: var(--white); border-radius: 12px; padding: .65rem .9rem; min-height: 44px; }
button:not(:disabled), select { cursor: pointer; }
button:disabled { opacity: .48; }
button:focus-visible, a:focus-visible, canvas:focus-visible, select:focus-visible { outline: 3px solid #7254a4; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 6vw, 3.8rem); line-height: .99; letter-spacing: -.065em; }
h2 { letter-spacing: -.035em; line-height: 1.1; }
.app { width: min(100%, 830px); margin: 0 auto; padding: 0 18px max(110px, calc(env(safe-area-inset-bottom) + 100px)); }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: env(safe-area-inset-top); }
.brand { display:flex; align-items:center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing:-.05em; }
.brand small { display: block; text-transform: uppercase; font-size: 9px; letter-spacing: .17em; color: var(--muted); }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; background: var(--purple); color: #ffcf9f; border-radius: 12px; }
.icon-button { padding: 0; min-width: 44px; font-size: 1.3rem; line-height: 1; }
main { display: grid; gap: 20px; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; isolation: isolate; background: #efdef8; border: 1px solid #e6d3f1; border-radius: 32px; overflow: hidden; min-height: 250px; }
.hero-copy { padding: clamp(16px, 5vw, 37px); z-index:1; }
.hero-copy p { color:#534167; margin: 13px 0 18px; line-height: 1.5; }
.hero-art { width:100%; max-height: 330px; object-fit: contain; background: radial-gradient(ellipse at center, #fff7ec 18%, transparent 70%); }
.pixel { image-rendering: pixelated; }
.primary { color: white; background: var(--purple); border-color: var(--purple); font-weight: 750; }
.primary:hover { background:#372062; }
.go-button { display:inline-flex; align-items:center; gap:8px; padding:10px 14px; min-height:44px; border-radius:13px; font-weight:750; }
.notice .go-button { margin-left:6px; text-decoration:underline; }
.section-head { display:flex; justify-content: space-between; align-items: center; gap:12px; margin-bottom:12px; }
.section-head a { font-weight: 750; color: var(--purple); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding:16px; }
.progress-block { display:grid; gap:10px; }
.progress-block span, .muted { color:var(--muted); }
progress { width:100%; height:10px; accent-color:#654199; }
.world-grid, .art-grid { display:grid; gap: 12px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.world-card { background: var(--world); border:1px solid #3a26531a; padding:0 13px 13px; border-radius:var(--radius); text-align:left; overflow:hidden; }
.world-card img { height: 116px; width: 100%; object-fit: contain; }
.world-card strong, .world-card small { display:block; }
.world-card small, .art-card small { margin-top:4px; color:#4e435d; }
.world-heading { display: grid; gap:8px; }
.art-card { display:grid; gap:4px; text-align:left; padding:8px; min-width:0; }
.thumbnail { aspect-ratio: 1.25; width:100%; height:auto; object-fit:contain; background: var(--world,#f1e6fb); border-radius: 12px; }
.art-card strong, .art-card small { padding-inline: 5px; }
.tabs { position: fixed; z-index: 3; inset: auto 10px max(10px, env(safe-area-inset-bottom)); max-width: 625px; margin:auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); padding:5px; border:1px solid #ddd0e6; border-radius: 25px; background:#fffaf5f4; box-shadow:0 10px 34px #30204d20; }
@supports (backdrop-filter: blur(15px)) { .tabs { background:#fffaf5d9; backdrop-filter: blur(15px); } }
.tabs a { padding: 5px; min-height: 54px; display:grid; justify-items:center; align-content:center; gap: 2px; border-radius:19px; text-align:center; }
.tabs a span { font-size:1.2rem; line-height:1; }
.tabs a b { font-size: .66rem; overflow-wrap:anywhere; }
.tabs a[aria-current="page"] { background:#eee3fb; color:var(--purple); }
.play-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.play-head h1 { font-size: clamp(1.35rem,4vw,2.1rem); letter-spacing:-.045em; }
.play-head div { display:grid; justify-items:end; gap:4px; text-align:right; }
.tools { display:flex; flex-wrap:wrap; gap:6px; }
.tools button { flex: 1 0 auto; }
.tools button[aria-pressed="true"] { color:#fff; background:var(--purple); }
.board-shell { position:relative; height:clamp(268px,92vw,590px); max-height:60vh; min-height:260px; border:1px solid #ded1ea; border-radius:22px; overflow:hidden; background:#eadff1; touch-action:none; }
.board-shell canvas { width:100%; height:100%; display:block; touch-action:none; }
.palette { display:flex; gap:7px; overflow-x:auto; padding:4px; }
.palette button { flex:0 0 44px; padding:0; display:grid; place-items:center; background:var(--swatch); color:var(--label); font-weight:800; }
.palette button[aria-pressed="true"] { outline:2px solid var(--ink); outline-offset:2px; }
.palette button[data-complete="true"] { opacity:.62; }
.notice { background:#dbefde; border-color:#b9dfbd; }
.profile-form { display:grid; gap:12px; }
.profile-form input[type=text] { padding:10px; border:1px solid var(--line); border-radius:12px; min-width:0; }
.avatars { display:flex; gap:8px; }
.avatars label { display:flex; gap:4px; align-items:center; min-height:44px; }
dialog { width:min(92%,510px); color:var(--ink); border:1px solid var(--line); border-radius:25px; background:var(--paper); padding:18px; }
dialog::backdrop { background:#27213b72; }
.dialog-heading, .row { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.row { padding:12px 0; }
.backup p { margin:8px 0; color:var(--muted); }
@media (min-width:620px) { .world-grid, .art-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:380px) { .app { padding-inline:10px; } .world-grid,.art-grid { gap:8px; } .hero { min-height:205px; } }
@media (prefers-reduced-motion: no-preference) {
  .art-card,.world-card,.primary { transition: transform 140ms ease, background-color 140ms ease; }
  .art-card:active,.world-card:active,.primary:active { transform: scale(.98); }
}
