/* Mischka Models – Styles. Große Touch-Ziele, verspielte Pastellfarben, keine externen Fonts. */
:root {
  --pink: #ff5fa2;
  --pink-dark: #e0457b;
  --pink-soft: #ffe0ee;
  --purple: #9d4edd;
  --lav: #f1e6ff;
  --ink: #4a2a5a;
  --ink-soft: #8a6f99;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(157, 78, 221, .18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #ffe3f1 0%, #f1e6ff 50%, #d9f6ff 100%) fixed;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.hidden { display: none !important; }
h2, h3, h4 { margin: 0; }

/* ---------- Logo & Buttons ---------- */
.logo { font-weight: 900; font-size: clamp(2.4rem, 7vw, 4.2rem); letter-spacing: -.02em; margin: 0; color: var(--pink); text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(255, 95, 162, .35); }
.logo span { color: var(--purple); }
.logo.small { font-size: 1.5rem; padding: 4px 8px; white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 8px 16px; border-radius: 999px; font-weight: 800;
  background: var(--card); box-shadow: 0 3px 0 rgba(157, 78, 221, .25); transition: transform .08s;
}
a.btn { text-decoration: none; color: var(--ink); }
a.btn.btn-primary { color: #fff; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(157, 78, 221, .25); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-primary { background: linear-gradient(180deg, #ff7db5, var(--pink)); color: #fff; box-shadow: 0 4px 0 var(--pink-dark); }
.btn-ghost { background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 2px rgba(157, 78, 221, .25); }
.btn.big { font-size: 1.25rem; min-height: 58px; padding: 10px 30px; }
.btn.wide { width: 100%; margin-top: 14px; }

/* ---------- Start ---------- */
#start { min-height: 100%; display: flex; justify-content: center; padding: 28px 16px 40px; }
.start-inner { width: 100%; max-width: 1040px; text-align: center; }
.tagline { font-size: 1.15rem; font-weight: 700; color: var(--ink-soft); margin: 6px 0 22px; }
.start-inner h2 { font-size: 1.5rem; margin: 22px 0 14px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.model-card {
  background: var(--card); border-radius: var(--radius); padding: 10px 8px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .15s;
}
.model-card:hover { transform: translateY(-6px) rotate(-1deg); }
.model-card svg { width: 100%; height: auto; border-radius: 16px; background: linear-gradient(180deg, var(--pink-soft), var(--lav)); }
.model-card span { font-weight: 900; font-size: 1.2rem; color: var(--purple); }

/* ---------- Spiel-Layout ---------- */
#game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); gap: 14px; padding: 0 14px 14px; }
.stage-wrap { position: relative; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
.stage-box { position: relative; height: 100%; max-width: 100%; aspect-ratio: 400 / 740; }
.turn-btn { position: absolute; right: 12px; bottom: 12px; width: 54px; height: 54px; border-radius: 50%; font-size: 1.5rem; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 rgba(157, 78, 221, .3), 0 6px 14px rgba(0, 0, 0, .15); }
.turn-btn:active { transform: translateY(2px); }
.name-btn { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 6px 16px; border-radius: 999px; font-weight: 800; font-size: 1.05rem; color: var(--purple); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 rgba(157, 78, 221, .3), 0 6px 14px rgba(0, 0, 0, .15); }
.name-btn:active { transform: translateX(-50%) translateY(2px); }
#stage.flip { animation: stage-flip .36s ease-in-out; }
@keyframes stage-flip { 50% { transform: scaleX(0); } }
#stage {
  display: block; width: 100%; height: 100%; border-radius: 28px; background: #fff;
  box-shadow: var(--shadow), inset 0 0 0 5px #fff; user-select: none; -webkit-user-select: none;
}
.view3d { display: block; width: 100%; height: 100%; border-radius: 28px; touch-action: none; cursor: grab; box-shadow: var(--shadow), inset 0 0 0 5px #fff;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .75) 0, rgba(255, 255, 255, 0) 60%), linear-gradient(180deg, #ffd6ec 0%, #efe2ff 60%, #e2d4ff 100%); }
.view3d.drawing { cursor: crosshair; box-shadow: var(--shadow), 0 0 0 5px var(--pink); }
#stage.drawing { cursor: crosshair; touch-action: none; box-shadow: var(--shadow), 0 0 0 5px var(--pink); }

.panel { min-height: 0; display: flex; flex-direction: column; background: rgba(255, 255, 255, .75); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(6px); }
.tabs { display: flex; gap: 4px; padding: 8px; background: rgba(255, 255, 255, .8); }
.tab { flex: 1; min-width: 0; padding: 6px 2px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-weight: 800; }
.tab-ico { font-size: 1.55rem; line-height: 1.1; }
.tab-name { font-size: .72rem; color: var(--ink-soft); }
.tab.sel { background: var(--pink); box-shadow: 0 3px 0 var(--pink-dark); }
.tab.sel .tab-name { color: #fff; }
.edit-title { flex: 1; text-align: center; font-weight: 900; color: var(--purple); padding: 10px 6px; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 18px; }

.sec { margin-top: 16px; }
.sec:first-child { margin-top: 0; }
.sec h3 { font-size: 1rem; margin-bottom: 8px; color: var(--purple); }
.sec h4 { font-size: .85rem; margin: 10px 0 6px; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-weight: 700; font-size: .95rem; }
.hint.warn { background: #fff4d6; border-radius: 12px; padding: 8px 10px; color: #8a5a00; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 42px; padding: 6px 14px; border-radius: 999px; background: #fff; font-weight: 800; box-shadow: inset 0 0 0 2px rgba(157, 78, 221, .2); display: inline-flex; align-items: center; gap: 6px; }
.chip.sel { background: var(--purple); color: #fff; box-shadow: 0 3px 0 #6f2db0; }
.dot { display: inline-block; border-radius: 50%; background: currentColor; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.grid.album { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-top: 14px; }
.tile-wrap { position: relative; }
.tile {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 18px; background: #fff; padding: 6px;
  box-shadow: inset 0 0 0 2px rgba(157, 78, 221, .15); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.grid.album .tile { aspect-ratio: 400 / 740; padding: 0; }
.tile:hover { box-shadow: inset 0 0 0 3px rgba(255, 95, 162, .5); }
.tile.sel { box-shadow: inset 0 0 0 4px var(--pink); background: var(--pink-soft); }
.thumb { width: 100%; height: 100%; display: block; pointer-events: none; }
.none { font-size: 1.8rem; opacity: .6; }
.badge { position: absolute; top: 4px; left: 6px; font-size: .9rem; }
.tile-label { position: absolute; left: 0; right: 0; bottom: 0; font-size: .7rem; font-weight: 800; padding: 3px 2px; background: rgba(255, 255, 255, .85); }
.mini { position: absolute; top: -6px; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); font-size: .95rem; }
.mini.del { right: -6px; }
.mini.edit { right: 32px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(74, 42, 90, .18), 0 2px 4px rgba(0, 0, 0, .1); }
.sw.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--pink); }
.sw-none { background: #fff; font-weight: 900; color: var(--ink-soft); }

.edit-actions { position: sticky; bottom: -18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px -14px -18px; padding: 12px 14px 14px; background: rgba(255, 255, 255, .95); box-shadow: 0 -6px 14px rgba(157, 78, 221, .12); }

/* ---------- Dialog & Toast ---------- */
.dialog { position: fixed; inset: 0; z-index: 20; background: rgba(74, 42, 90, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog-box { background: #fff; border-radius: 26px; padding: 22px; max-width: 480px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.img-pick { width: 100%; font: inherit; font-size: .95rem; margin-top: 6px; }
.img-or { margin: 12px 0 6px; font-weight: 800; color: var(--ink-soft); }
.img-url-row { display: flex; gap: 8px; align-items: center; }
.img-url-row input { flex: 1; min-width: 0; margin: 0; text-align: left; font-size: 1rem; }
.img-found { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0 6px; }
.img-preview { width: 92px; height: 92px; object-fit: cover; border-radius: 16px; border: 2px solid var(--lav); flex: none; }
.dialog-box h3 { font-size: 1.4rem; color: var(--purple); }
.dialog-box textarea { width: 100%; border: 2px solid var(--lav); border-radius: 14px; padding: 10px; font: .8rem/1.3 ui-monospace, Consolas, monospace; resize: none; color: var(--ink); word-break: break-all; }
.name-input { width: 100%; border: 2px solid var(--lav); border-radius: 14px; padding: 12px 14px; margin: 10px 0 6px; font: inherit; font-size: 1.3rem; font-weight: 800; color: var(--ink); text-align: center; }
.name-input:focus { outline: none; border-color: var(--pink, #ff5fa2); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); z-index: 30; background: var(--ink); color: #fff; font-weight: 800; padding: 12px 22px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Galerie / Schau-Seite ---------- */
.show-page { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 20px 16px 40px; text-align: center; }
.show-single { width: min(440px, 92vw); border-radius: 28px; box-shadow: var(--shadow), inset 0 0 0 5px #fff; background: #fff; margin: 14px 0; }
.show-title { font-size: 1.4rem; font-weight: 900; color: var(--purple); }
.gallery { width: 100%; max-width: 1100px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin: 18px 0; }
.gallery a { display: block; background: #fff; border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); text-decoration: none; color: var(--purple); font-weight: 900; transition: transform .15s; }
.gallery a:hover { transform: translateY(-5px); }
.gallery svg { width: 100%; height: auto; border-radius: 16px; display: block; }

/* ---------- Tablet hochkant & Handy ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 44dvh minmax(0, 1fr); gap: 10px; padding: 0 10px 10px; }
  .topbar { padding: 6px 10px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions { flex-wrap: nowrap; gap: 6px; }
  .topbar-actions .btn { padding: 6px 10px; min-height: 42px; font-size: 1.1rem; }
  .logo.small { font-size: 1.15rem; padding: 4px 2px; }
  .tab-name { font-size: .64rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
