:root {
  --cream: #fff8ee; --cream2: #ffeedd; --ink: #4a3b5c; --ink2: #7a6a8f;
  --coral: #ff7aa2; --coral-d: #e0527f; --mint: #5fd8b0; --mint-d: #35b88c; --sky: #7ab8ff; --sky-d: #4f92e6;
  --sun: #ffd45e; --sun-d: #e6aa2c; --grape: #a98bff; --grape-d: #7e5fe0; --warn: #ff7a6a;
  --shadow: 0 6px 0 rgba(74, 59, 92, .18), 0 10px 24px rgba(74, 59, 92, .22);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe6ff; font-family: var(--font); color: var(--ink); overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: none; }
#hud button, #hud .pill, #hud #hotbar, #hud #shapes, #hud #swatches, #hud .pop { pointer-events: auto; }
#topLeft { position: absolute; left: calc(12px + var(--sa-l)); top: calc(10px + var(--sa-t)); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#me { display: flex; align-items: center; gap: 8px; background: var(--cream); border-radius: 28px; padding: 4px 14px 4px 4px; box-shadow: var(--shadow); font-weight: 800; font-size: 15px; max-width: 220px; }
#me canvas { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(#cfeaff, #fff0f5); }
#meName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: flex; align-items: center; gap: 8px; background: var(--cream); border-radius: 22px; padding: 6px 12px 6px 8px; box-shadow: var(--shadow); font-weight: 800; }
.pill .ico { width: 26px; height: 26px; display: grid; place-items: center; color: var(--sun-d); }
.pill .ico svg { width: 24px; height: 24px; }
.bar { position: relative; width: clamp(110px, 24vw, 190px); height: 20px; background: #e9dcf0; border-radius: 12px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(74, 59, 92, .12); }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(#ffe27a, #ffbf3d); border-radius: 12px; transition: width .25s ease-out; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .5); }
.bar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: #5a3d00; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.pill.warn { color: #8a2a30; background: #ffe3dd; }
.pill.warn .ico { color: #8a5560; }
.pill.low .bar i { background: linear-gradient(#ffa59a, #ff6f61); }
.pill.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
#topRight { position: absolute; right: calc(12px + var(--sa-r)); top: calc(10px + var(--sa-t)); display: flex; gap: 10px; }

.rbtn { width: 48px; height: 48px; border-radius: 50%; background: var(--cream); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); transition: transform .12s; }
.rbtn:active { transform: translateY(3px) scale(.96); box-shadow: 0 2px 0 rgba(74, 59, 92, .18); }
.rbtn svg { width: 26px; height: 26px; }
.rbtn.big { width: 62px; height: 62px; }
.rbtn.big svg { width: 32px; height: 32px; }
.rbtn.huge { position: absolute; width: 84px; height: 84px; background: var(--mint); color: #fff; box-shadow: 0 7px 0 var(--mint-d), 0 12px 24px rgba(0, 80, 60, .3); right: calc(22px + var(--sa-r)); bottom: calc(28px + var(--sa-b)); }
.rbtn.huge svg { width: 42px; height: 42px; stroke-width: 3; }
.rbtn.huge:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--mint-d); }
#btnTool.dig { background: #ffd9a8; color: #a1560a; }
#btnTool.build { background: #c9f5e4; color: #0b7a55; }
.rbtn.flag { background: var(--coral); color: #fff; }
.rbtn.flag.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
#side { position: absolute; right: calc(14px + var(--sa-r)); bottom: calc(136px + var(--sa-b)); display: flex; flex-direction: column; gap: 12px; align-items: center; }
body[data-input="key"] #btnJump, body[data-input="mouse"] #btnJump { display: none; }
body[data-input="key"] #side, body[data-input="mouse"] #side { bottom: calc(100px + var(--sa-b)); right: calc(14px + var(--sa-r)); }

#bottom { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--sa-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#hotbar { display: flex; gap: 8px; padding: 8px; background: rgba(255, 248, 238, .92); border-radius: 26px; box-shadow: var(--shadow); max-width: calc(100vw - 150px); }
@media (max-width: 700px) { #hotbar { max-width: calc(100vw - 20px); gap: 5px; padding: 6px; } }
.slot { position: relative; width: 56px; height: 56px; border-radius: 18px; background: #f0e3f4; display: grid; place-items: center; transition: transform .15s cubic-bezier(.3, 1.8, .5, 1), background .15s; flex: none; }
@media (max-width: 700px) { .slot { width: 44px; height: 44px; border-radius: 14px; } }
.slot canvas { width: 82%; height: 82%; pointer-events: none; }
.slot.sel { background: #fff; transform: translateY(-8px) scale(1.12); box-shadow: 0 0 0 4px var(--coral), 0 8px 14px rgba(224, 82, 127, .35); }
.slot .num { position: absolute; left: 6px; top: 2px; font-size: 11px; font-weight: 900; color: var(--ink2); }
body[data-input="touch"] .slot .num { display: none; }
.slot.more { background: var(--sky); color: #fff; font-size: 26px; font-weight: 900; }
#shapes { display: flex; gap: 6px; background: rgba(255, 248, 238, .9); padding: 5px; border-radius: 20px; box-shadow: var(--shadow); }
#shapes button { width: 42px; height: 38px; border-radius: 14px; display: grid; place-items: center; background: #f0e3f4; }
#shapes button.sel { background: var(--sun); box-shadow: 0 3px 0 var(--sun-d); }
#shapes canvas { width: 30px; height: 30px; pointer-events: none; }
#swatches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: min(92vw, 520px); background: rgba(255, 248, 238, .94); padding: 8px; border-radius: 20px; box-shadow: var(--shadow); }
.sw { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sw button, #swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), 0 2px 4px rgba(0, 0, 0, .15); transition: transform .12s; }
.sw button.sel, #swatches button.sel { transform: scale(1.25); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--coral); }

#toasts { position: absolute; left: 0; right: 0; top: calc(78px + var(--sa-t)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 22px; font-weight: 800; font-size: 15px; box-shadow: var(--shadow); animation: toast 2.8s forwards; max-width: 86vw; text-align: center; }
.toast.good { background: var(--mint-d); } .toast.bad { background: var(--warn); }
@keyframes toast { 0% { transform: translateY(-20px) scale(.8); opacity: 0; } 8% { transform: translateY(0) scale(1.05); opacity: 1; } 14% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
#chatLog { position: absolute; left: calc(12px + var(--sa-l)); bottom: calc(210px + var(--sa-b)); display: flex; flex-direction: column; gap: 4px; max-width: min(60vw, 340px); }
body[data-input="touch"] #chatLog { bottom: calc(190px + var(--sa-b)); left: calc(16px + var(--sa-l)); }
.msg-line { background: rgba(255, 248, 238, .88); padding: 5px 12px; border-radius: 16px; font-size: 14px; font-weight: 700; animation: fadeout 9s forwards; width: fit-content; }
.msg-line b { color: var(--coral-d); }
@keyframes fadeout { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Name Tags */
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); text-align: center; will-change: transform; white-space: nowrap; }
.tag .nm { display: inline-block; background: rgba(255, 248, 238, .92); padding: 2px 10px; border-radius: 14px; font-size: 13px; font-weight: 900; box-shadow: 0 2px 0 rgba(74, 59, 92, .18); }
.tag .nm.chaos { background: #4e4a68; color: #ffe0e0; }
.tag .bub { display: block; margin: 0 auto 4px; background: #fff; padding: 6px 12px; border-radius: 16px; font-size: 14px; font-weight: 800; max-width: 220px; white-space: normal; box-shadow: 0 3px 0 rgba(74, 59, 92, .2); animation: pop .25s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
#cost { position: fixed; z-index: 4; pointer-events: none; transform: translate(-50%, -140%); background: var(--ink); color: #fff; padding: 3px 10px; border-radius: 14px; font-weight: 900; font-size: 13px; display: none; white-space: nowrap; }
#cost.hostile { background: var(--warn); } #cost.refund { background: var(--mint-d); } #cost.nope { background: #8a7a9a; }

/* Joystick */
#joy { position: fixed; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; background: rgba(255, 255, 255, .28); border: 4px solid rgba(255, 255, 255, .55); display: none; z-index: 4; pointer-events: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 5px 0 rgba(74, 59, 92, .2); }

/* Popups */
.pop { position: absolute; right: calc(12px + var(--sa-r)); top: calc(68px + var(--sa-t)); background: var(--cream); border-radius: 26px; padding: 10px; box-shadow: var(--shadow); display: flex; gap: 8px; animation: pop .2s cubic-bezier(.3, 1.8, .5, 1); }
.pop button { width: 54px; height: 54px; border-radius: 50%; background: #f0e3f4; display: grid; place-items: center; color: var(--ink); }
.pop button:active { background: var(--sun); }
.pop svg { width: 34px; height: 34px; }

/* Screens */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: linear-gradient(180deg, rgba(150, 210, 255, .0), rgba(255, 220, 235, .0)); overflow: auto; padding: 16px; }
#start { background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 60%); touch-action: pan-y; }
#loading, #offline { background: rgba(190, 230, 255, .94); flex-direction: column; gap: 18px; font-weight: 900; font-size: 20px; }
.card { background: var(--cream); border-radius: 36px; padding: 22px 24px 26px; width: min(94vw, 430px); box-shadow: var(--shadow); text-align: center; animation: rise .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rise { from { transform: translateY(40px) scale(.9); opacity: 0; } }
.logo { font-size: 46px; font-weight: 900; letter-spacing: -1px; color: var(--ink); line-height: 1; }
.logo span { color: var(--coral); display: inline-block; animation: wob 2.4s ease-in-out infinite; }
.logo.small { font-size: 30px; }
@keyframes wob { 50% { transform: rotate(-4deg) translateY(-3px) scale(1.04); } }
.sub { margin: 6px 0 12px; color: var(--ink2); font-weight: 700; }
.preview { display: flex; align-items: center; justify-content: center; }
#prevCanvas { width: 210px; height: 210px; background: radial-gradient(circle, #fff6ea 0, #ffe6f0 62%, #d7ecff 100%); border-radius: 50%; margin: 0 6px; box-shadow: inset 0 -6px 0 rgba(74, 59, 92, .08); }
.arrow { width: 44px; height: 44px; border-radius: 50%; background: var(--sky); color: #fff; font-size: 28px; font-weight: 900; box-shadow: 0 4px 0 var(--sky-d); }
.arrow:active { transform: translateY(3px); box-shadow: none; }
.spname { font-weight: 900; font-size: 22px; margin: 6px 0 4px; }
.label { font-weight: 800; font-size: 13px; color: var(--ink2); margin: 8px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
#nameIn, #chatIn { width: 100%; margin-top: 14px; padding: 13px 18px; border-radius: 22px; border: 3px solid #eadcf0; background: #fff; font: 800 18px var(--font); text-align: center; color: var(--ink); -webkit-user-select: text; user-select: text; }
#chatIn { margin: 0; text-align: left; }
.cta { margin-top: 16px; width: 100%; padding: 16px; font-size: 22px; font-weight: 900; color: #fff; background: var(--coral); border-radius: 26px; box-shadow: 0 7px 0 var(--coral-d); transition: transform .1s; }
.cta:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--coral-d); }
.cta:disabled { opacity: .6; }
.msg { min-height: 20px; margin-top: 8px; color: var(--warn); font-weight: 800; font-size: 14px; }
.btn { padding: 9px 16px; border-radius: 18px; background: var(--sky); color: #fff; font-weight: 900; box-shadow: 0 4px 0 var(--sky-d); }
.btn:active { transform: translateY(3px); box-shadow: none; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 7px solid #fff; border-top-color: var(--coral); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; z-index: 15; background: rgba(74, 59, 92, .35); display: grid; place-items: end center; backdrop-filter: blur(4px); touch-action: pan-y; }
.sheet { background: var(--cream); width: min(100vw, 640px); max-height: 82vh; overflow: auto; border-radius: 34px 34px 0 0; padding: 16px 18px calc(22px + var(--sa-b)); animation: sheet .3s cubic-bezier(.2, 1.2, .4, 1); }
.sheet.small { width: min(100vw, 480px); }
@keyframes sheet { from { transform: translateY(60%); opacity: .3; } }
.sheetHead { display: flex; justify-content: space-between; align-items: center; }
.sheetHead h2 { margin: 0; font-size: 26px; font-weight: 900; }
#catGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; margin: 12px 0; }
#catGrid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; background: #f6ebf8; border-radius: 20px; font-size: 12px; font-weight: 800; }
#catGrid button canvas { width: 54px; height: 54px; }
#catGrid button.sel { background: #fff; box-shadow: 0 0 0 4px var(--coral); }
#catGrid .cost { color: var(--sun-d); font-weight: 900; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; font-weight: 800; border-bottom: 2px dashed #eadcf0; }
.seg { display: flex; background: #f0e3f4; border-radius: 18px; padding: 3px; }
.seg button { padding: 7px 12px; border-radius: 15px; font-weight: 900; font-size: 14px; }
.seg button.sel { background: var(--coral); color: #fff; box-shadow: 0 3px 0 var(--coral-d); }
.help { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--ink2); font-weight: 700; }
.help kbd { background: #f0e3f4; padding: 1px 7px; border-radius: 8px; font: 800 12px var(--font); color: var(--ink); }
.fine { margin-top: 10px; font-size: 12px; color: var(--ink2); opacity: .8; }
.chatbox { position: fixed; z-index: 16; left: 50%; bottom: calc(110px + var(--sa-b)); transform: translateX(-50%); width: min(92vw, 460px); display: flex; gap: 8px; background: var(--cream); padding: 8px; border-radius: 28px; box-shadow: var(--shadow); }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 30; background: #fff; opacity: 0; }
#flash.on { animation: flash .5s; }
@keyframes flash { 0% { opacity: .7; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo span, .rbtn.flag.pulse { animation: none; } }

/* Querformat auf Handys: kompaktere Leisten und zweispaltige Startkarte */
@media (max-height: 560px) {
  .slot { width: 42px; height: 42px; border-radius: 14px; }
  .slot.sel { transform: translateY(-5px) scale(1.1); }
  #hotbar { gap: 5px; padding: 5px; border-radius: 20px; }
  #shapes button { width: 36px; height: 30px; } #shapes canvas { width: 24px; height: 24px; }
  #bottom { gap: 5px; bottom: calc(6px + var(--sa-b)); }
  .rbtn.huge { width: 72px; height: 72px; bottom: calc(14px + var(--sa-b)); }
  #side { bottom: calc(96px + var(--sa-b)); gap: 8px; }
  .rbtn.big { width: 52px; height: 52px; }
  #chatLog { bottom: calc(130px + var(--sa-b)); }
  .card { width: min(96vw, 740px); padding: 14px 20px 16px; }
  .logo { font-size: 34px; }
  .sub { margin: 2px 0 8px; }
  #pick { display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; align-items: center; }
  #prevCanvas { width: 150px; height: 150px; }
  .spname { font-size: 18px; margin: 2px 0; }
  .label { margin: 2px 0 4px; }
  .sw button { width: 24px; height: 24px; }
  .sw { gap: 6px; }
  #nameIn { margin-top: 8px; padding: 9px 14px; font-size: 16px; }
  .cta { margin-top: 10px; padding: 11px; font-size: 19px; }
  .msg { min-height: 14px; margin-top: 4px; }
  .sheet { max-height: 92vh; }
}

.linkbtn { margin-top: 10px; font-weight: 800; font-size: 14px; color: var(--sky-d); text-decoration: underline; text-underline-offset: 3px; }
.acct { padding: 12px 0; border-bottom: 2px dashed #eadcf0; font-weight: 700; font-size: 14px; line-height: 1.45; }
.acct h3 { margin: 0 0 6px; font-size: 16px; font-weight: 900; }
.acct input { width: 100%; margin: 8px 0; padding: 11px 14px; border-radius: 18px; border: 3px solid #eadcf0; font: 800 16px var(--font); color: var(--ink); background: #fff; -webkit-user-select: text; user-select: text; }
.acct .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.acct .ok { color: var(--mint-d); font-weight: 900; }
.acct .err { color: var(--warn); font-weight: 800; min-height: 18px; }
.btn.alt { background: #cdb9e6; box-shadow: 0 4px 0 #a98fcb; } .btn.danger { background: var(--warn); box-shadow: 0 4px 0 #d4574a; }
#loginBox { margin-top: 10px; text-align: left; }
#loginBox input { width: 100%; margin: 6px 0; padding: 11px 14px; border-radius: 18px; border: 3px solid #eadcf0; font: 800 16px var(--font); text-align: center; color: var(--ink); background: #fff; -webkit-user-select: text; user-select: text; }
#photo { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#photo > * { pointer-events: auto; }
.photoTop { position: absolute; left: calc(14px + var(--sa-l)); top: calc(12px + var(--sa-t)); }
.photoBar { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--sa-b)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
#filters { display: flex; gap: 8px; background: rgba(255, 248, 238, .9); padding: 6px; border-radius: 22px; box-shadow: var(--shadow); max-width: 96vw; overflow-x: auto; }
#filters button { padding: 8px 14px; border-radius: 16px; font-weight: 900; font-size: 14px; white-space: nowrap; background: #f0e3f4; }
#filters button.sel { background: var(--coral); color: #fff; box-shadow: 0 3px 0 var(--coral-d); }
#shutter { width: 76px; height: 76px; border-radius: 50%; background: #fff; border: 7px solid var(--coral); box-shadow: 0 6px 0 var(--coral-d), 0 10px 24px rgba(0, 0, 0, .25); transition: transform .1s; }
#shutter:active { transform: translateY(4px) scale(.94); }
body.photo #hud, body.photo #tags, body.photo #cost { visibility: hidden; }

#btnTool.use { background: #cfe6ff; color: #1f64b8; }
#hearts { color: #c23a64; }
#hearts .ico { color: #ff5c8a; }

#catTabs { display: flex; gap: 6px; margin: 10px 0 4px; overflow-x: auto; }
#catTabs button { padding: 8px 16px; border-radius: 18px; background: #f0e3f4; font-weight: 900; font-size: 15px; white-space: nowrap; }
#catTabs button.sel { background: var(--coral); color: #fff; box-shadow: 0 3px 0 var(--coral-d); }

/* Baustein-Dialog: immer gleich groß, Inhalt scrollt */
#catalog .sheet { height: min(78vh, 580px); display: flex; flex-direction: column; overflow: hidden; }
#catalog #catGrid { flex: 1; overflow-y: auto; align-content: start; min-height: 0; padding: 2px 2px 6px; }
#catalog .label, #catalog #catSw { flex: none; }
@media (max-height: 560px) { #catalog .sheet { height: 92vh; } }

.tag .nm.npc { background: #d9f6e7; color: #1d6a4b; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; } .chip { background: #e6f7ee; color: #1d6a4b; padding: 4px 6px 4px 12px; border-radius: 14px; font-weight: 800; } .chip button { margin-left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; font-weight: 900; }

#meLv { font-size: 12px; background: var(--sun); color: #5a3d00; border-radius: 10px; padding: 1px 7px; margin-left: 2px; }
#meModal .sheet { height: min(80vh, 600px); display: flex; flex-direction: column; overflow: hidden; }
#mmBody { flex: 1; overflow-y: auto; min-height: 0; }
#mmTabs { display: flex; gap: 6px; margin: 8px 0; overflow-x: auto; } #mmTabs button { padding: 8px 14px; border-radius: 18px; background: #f0e3f4; font-weight: 900; white-space: nowrap; } #mmTabs button.sel { background: var(--coral); color: #fff; box-shadow: 0 3px 0 var(--coral-d); }
.xpbar { height: 14px; background: #e9dcf0; border-radius: 10px; overflow: hidden; margin: 6px 0; } .xpbar i { display: block; height: 100%; background: linear-gradient(#a98bff, #7e5fe0); border-radius: 10px; }
.qrow { background: #f6ebf8; border-radius: 18px; padding: 10px 14px; margin: 8px 0; font-weight: 800; } .qrow.done { background: #dff6e9; } .qrow .bar2 { height: 10px; background: #e5d6ee; border-radius: 8px; overflow: hidden; margin-top: 6px; } .qrow .bar2 i { display: block; height: 100%; background: var(--mint); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card2 { background: #f6ebf8; border-radius: 18px; padding: 10px; text-align: center; font-weight: 800; font-size: 13px; } .card2.on { background: #fff; box-shadow: 0 0 0 3px var(--mint); } .card2.locked { opacity: .55; } .card2 canvas { width: 54px; height: 54px; }
.cry { color: #7e5fe0; font-weight: 900; }
.toplist { margin: 6px 0 14px; padding-left: 20px; font-weight: 800; }

.rbtn.stampb { background: #e6dcff; color: #5a3fc0; } .rbtn.stampb.on { background: var(--grape); color: #fff; }
.bprow { display: flex; align-items: center; gap: 8px; background: #f6ebf8; border-radius: 16px; padding: 8px 12px; margin: 6px 0; font-weight: 800; } .bprow .nm { flex: 1; } .bprow .btn { padding: 6px 12px; font-size: 13px; }

/* Baustein-Dialog groß: Rechner ca. 86 %, Touch-Geräte vollbild */
#catalog { place-items: center; padding: 0; }
#catalog .sheet { width: min(94vw, 1180px); height: 86vh; max-height: none; border-radius: 34px; padding: 18px 22px 22px; }
#catalog #catGrid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
#catalog #catGrid button { padding: 12px 6px; font-size: 13px; border-radius: 22px; } #catalog #catGrid button canvas { width: 66px; height: 66px; }
@media (pointer: coarse), (max-width: 700px) {
  #catalog .sheet { width: 100vw; height: 100dvh; border-radius: 0; padding: calc(14px + var(--sa-t)) calc(14px + var(--sa-r)) calc(14px + var(--sa-b)) calc(14px + var(--sa-l)); }
  #catalog #catGrid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  #catalog #catGrid button canvas { width: 58px; height: 58px; }
}

/* Handy im Hochformat: nur 3 Blöcke + Plus links, Knöpfe oben rechts als Spalte, nichts überlappt */
@media (max-width: 700px) and (orientation: portrait) {
  .slot:nth-child(n+4):not(.more) { display: none; }
  #bottom { align-items: flex-start; padding-left: calc(10px + var(--sa-l)); }
  #hotbar { max-width: calc(100vw - 120px); }
  #swatches { max-width: calc(100vw - 120px); flex-wrap: wrap; }
  #topRight { flex-direction: column; gap: 8px; }
  #topRight .rbtn { width: 44px; height: 44px; }
  #topRight .rbtn svg { width: 24px; height: 24px; }
  #topLeft { max-width: calc(100vw - 84px); }
  #toasts { top: calc(124px + var(--sa-t)); right: 64px; max-width: none; }
  #side { bottom: calc(118px + var(--sa-b)); gap: 8px; }
  .rbtn.big { width: 54px; height: 54px; }
  #chatLog { bottom: calc(150px + var(--sa-b)); max-width: calc(100vw - 100px); }
}
#catSearch { width: 100%; box-sizing: border-box; margin: 4px 0 10px; padding: 12px 18px; border: 3px solid #eadcf0; border-radius: 22px; background: #fff; font: inherit; font-weight: 800; font-size: 16px; color: var(--ink); outline: none; }
#catSearch:focus { border-color: var(--sky); }
#catGrid .empty { grid-column: 1 / -1; text-align: center; font-weight: 800; color: var(--ink2); padding: 30px 0; }
.legal { margin-top: 12px; text-align: center; font-size: 13px; font-weight: 800; color: var(--ink2); }
.legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#playerPop { left: 50%; right: auto; top: calc(130px + var(--sa-t)); transform: translateX(-50%); flex-direction: column; align-items: stretch; min-width: 220px; gap: 8px; padding: 14px; }
#playerPop .pname { font-weight: 900; font-size: 18px; text-align: center; }
#playerPop .rbtn { align-self: center; width: 40px; height: 40px; }
#playerPop .psub { font-weight: 800; font-size: 14px; color: var(--ink2); text-align: center; max-width: 240px; }
