/* ========== Temalar ========== */
:root {
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --radius: 20px;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --transition: .25s cubic-bezier(.2,.8,.2,1);
}
:root[data-theme="midnight"] {
  --bg: #0b0716; --bg2: #150d2b; --surface: rgba(255,255,255,.05); --surface-2: rgba(255,255,255,.09);
  --text: #f5f0ff; --muted: #a79bc4; --border: rgba(255,255,255,.1);
  --accent: #ff3d81; --accent-2: #8b5cf6; --accent-3: #22d3ee;
  --die-bg: #fff; --die-pip: #1a1030;
  --orb1: #ff3d81; --orb2: #8b5cf6; --orb3: #22d3ee;
}
:root[data-theme="rose"] {
  --bg: #1a0610; --bg2: #2c0a1c; --surface: rgba(255,255,255,.06); --surface-2: rgba(255,255,255,.1);
  --text: #fff1f6; --muted: #d9a3bb; --border: rgba(255,255,255,.12);
  --accent: #ff4d6d; --accent-2: #ff8fa3; --accent-3: #ffb3c6;
  --die-bg: #fff5f8; --die-pip: #a4133c;
  --orb1: #ff4d6d; --orb2: #c9184a; --orb3: #ff8fa3;
}
:root[data-theme="ember"] {
  --bg: #120802; --bg2: #24100a; --surface: rgba(255,255,255,.06); --surface-2: rgba(255,255,255,.1);
  --text: #fff4ea; --muted: #d4a98a; --border: rgba(255,255,255,.12);
  --accent: #ff6b1a; --accent-2: #ffb703; --accent-3: #f72585;
  --die-bg: #fff8f0; --die-pip: #7f2b00;
  --orb1: #ff6b1a; --orb2: #ffb703; --orb3: #f72585;
}
:root[data-theme="ocean"] {
  --bg: #03111f; --bg2: #061f36; --surface: rgba(255,255,255,.06); --surface-2: rgba(255,255,255,.1);
  --text: #ecfbff; --muted: #8fbfd6; --border: rgba(255,255,255,.12);
  --accent: #00c2ff; --accent-2: #7c3aed; --accent-3: #2dd4bf;
  --die-bg: #f2fbff; --die-pip: #073b5a;
  --orb1: #00c2ff; --orb2: #7c3aed; --orb3: #2dd4bf;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body); color: var(--text);
  background: radial-gradient(1200px 800px at 20% -10%, var(--bg2), var(--bg) 60%);
  min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* Arka plan küreleri */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span { position: absolute; width: 50vmax; height: 50vmax; border-radius: 50%; filter: blur(90px); opacity: .28; animation: drift 18s ease-in-out infinite alternate; }
.bg-orbs span:nth-child(1) { background: var(--orb1); top: -20%; left: -10%; }
.bg-orbs span:nth-child(2) { background: var(--orb2); bottom: -25%; right: -10%; animation-delay: -6s; }
.bg-orbs span:nth-child(3) { background: var(--orb3); top: 40%; left: 55%; width: 30vmax; height: 30vmax; animation-delay: -12s; opacity: .18; }
@keyframes drift { to { transform: translate(8%, 6%) scale(1.1); } }

/* ========== Yaş kapısı ========== */
.gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(5,2,12,.92); backdrop-filter: blur(12px); padding: 16px; }
.gate-card { text-align: center; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 32px; box-shadow: var(--shadow); }
.gate-icon { font-size: 3.5rem; }
.gate-card h1 { font-size: 2rem; margin: 8px 0 12px; }
.gate-card p { color: var(--muted); margin-bottom: 24px; }
.gate-card .btn { width: 100%; margin-bottom: 10px; }

/* ========== Üst bar ========== */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px clamp(16px, 4vw, 40px); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 2.2rem; filter: drop-shadow(0 4px 12px rgba(255,61,129,.5)); }
.brand h1 { font-size: 1.5rem; letter-spacing: .3px; }
.tagline { margin: 0; color: var(--muted); font-size: .85rem; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.1rem; transition: var(--transition); }
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.icon-btn.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,61,129,.2); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }

/* ========== Sahne ========== */
.stage { max-width: 960px; margin: 0 auto; padding: 8px 16px 60px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.mode-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.mode { border: 0; background: transparent; color: var(--muted); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: var(--transition); }
.mode.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 20px rgba(255,61,129,.35); }

/* ========== 3D Zarlar ========== */
.dice-arena { display: flex; gap: clamp(24px, 6vw, 64px); justify-content: center; flex-wrap: wrap; min-height: 220px; padding: 20px 0 36px; }
.die-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; animation: pop .4s var(--transition) both; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.die-stage { position: relative; width: clamp(86px, 14vw, 120px); height: clamp(86px, 14vw, 120px); perspective: 700px; perspective-origin: 50% 30%; }
.die-stage::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -26px; height: 18px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,0) 70%); transform: scale(var(--shadow-scale, 1)); opacity: var(--shadow-opacity, 1); transition: transform .2s, opacity .2s; }
.die { --size: clamp(86px, 14vw, 120px); width: var(--size); height: var(--size); position: relative; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(25deg); will-change: transform; }
.face { box-shadow: inset 0 0 0 2px rgba(0,0,0,.06), inset 0 -10px 18px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.04); }
.face { position: absolute; inset: 0; background: var(--die-bg); border-radius: 18%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 12%; box-shadow: inset 0 0 0 2px rgba(0,0,0,.05), inset 0 -8px 16px rgba(0,0,0,.12); backface-visibility: hidden; }
.pip { width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--die-pip); box-shadow: inset 0 2px 3px rgba(0,0,0,.5); align-self: center; justify-self: center; max-width: 70%; }
.face-1 { transform: translateZ(calc(var(--size) / 2)); }
.face-2 { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.face-3 { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.face-4 { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.face-5 { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.face-6 { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
/* Nokta yerleşimleri */
.face-1 .pip { grid-area: 2 / 2; }
.face-2 .pip:nth-child(1) { grid-area: 1 / 1; } .face-2 .pip:nth-child(2) { grid-area: 3 / 3; }
.face-3 .pip:nth-child(1) { grid-area: 1 / 1; } .face-3 .pip:nth-child(2) { grid-area: 2 / 2; } .face-3 .pip:nth-child(3) { grid-area: 3 / 3; }
.face-4 .pip:nth-child(1) { grid-area: 1 / 1; } .face-4 .pip:nth-child(2) { grid-area: 1 / 3; } .face-4 .pip:nth-child(3) { grid-area: 3 / 1; } .face-4 .pip:nth-child(4) { grid-area: 3 / 3; }
.face-5 .pip:nth-child(1) { grid-area: 1 / 1; } .face-5 .pip:nth-child(2) { grid-area: 1 / 3; } .face-5 .pip:nth-child(3) { grid-area: 2 / 2; } .face-5 .pip:nth-child(4) { grid-area: 3 / 1; } .face-5 .pip:nth-child(5) { grid-area: 3 / 3; }
.face-6 .pip:nth-child(1) { grid-area: 1 / 1; } .face-6 .pip:nth-child(2) { grid-area: 1 / 3; } .face-6 .pip:nth-child(3) { grid-area: 2 / 1; } .face-6 .pip:nth-child(4) { grid-area: 2 / 3; } .face-6 .pip:nth-child(5) { grid-area: 3 / 1; } .face-6 .pip:nth-child(6) { grid-area: 3 / 3; }
.die-wrap.extra .face { background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.die-wrap.extra .pip { background: #fff; }
.die-label { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.die-label strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.die-label span { font-weight: 700; font-size: 1rem; min-height: 1.2em; }

/* ========== Zar at düğmesi ========== */
.roll-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.roll-btn { position: relative; border: 0; padding: 20px 56px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 800; letter-spacing: .18em; font-size: 1.25rem; box-shadow: 0 16px 40px rgba(255,61,129,.4); transition: var(--transition); overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.roll-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 20px 50px rgba(255,61,129,.55); }
.roll-btn:active { transform: scale(.97); }
.roll-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.roll-glow { position: absolute; inset: -50%; background: conic-gradient(from 0deg, transparent, rgba(255,255,255,.35), transparent 30%); animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.roll-text { position: relative; }
.roll-hint { position: relative; font-size: .65rem; letter-spacing: .1em; font-weight: 500; opacity: .8; }
.pool-info { font-size: .8rem; color: var(--muted); }

/* ========== Maraton ========== */
.marathon { width: 100%; max-width: 720px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.marathon-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.marathon-row label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.marathon-row input { width: 90px; }
.marathon-progress { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.marathon-progress span { flex: 1; min-width: 24px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.marathon-progress span.done { background: var(--accent-3); }
.marathon-progress span.now { background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .5; } }

/* ========== Sonuç kartı ========== */
.result { width: 100%; max-width: 720px; animation: rise .5s var(--transition) both; }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.card-media { display: grid; place-items: center; background: #fff7f2; position: relative; overflow: hidden; min-height: 200px; }
.card-media img { display: block; max-width: 100%; max-height: min(60vh, 480px); width: auto; height: auto; object-fit: contain; padding: 12px; }
.card-media .card-emoji { padding: 50px 0; }
.card-emoji { font-size: 6rem; filter: drop-shadow(0 12px 24px rgba(0,0,0,.4)); animation: bounce 1.2s var(--transition); }
@keyframes bounce { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.2) rotate(8deg); } 100% { transform: none; } }
.card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cat-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--cat, var(--accent)); color: #fff; }
.card-actions { display: flex; gap: 6px; }
.chip-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 1.1rem; transition: var(--transition); }
.chip-btn:hover { transform: scale(1.08); }
.chip-btn.on { background: #facc15; color: #4a3600; border-color: transparent; }
.card h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.1; }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.meter { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.meter-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.meter-val { font-weight: 700; letter-spacing: 1px; }
.desc { margin: 0; line-height: 1.6; font-size: 1.02rem; }
.tip { background: rgba(250,204,21,.1); border-left: 3px solid #facc15; padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .92rem; line-height: 1.5; }
.tip:empty { display: none; }
.tip::before { content: '💡 İpucu: '; font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: .75rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.combo-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.combo-item { background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(255,61,129,.2)); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.combo-item .ci { font-size: 1.5rem; }
.combo-item small { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.combo-item b { font-size: .95rem; }

/* Zamanlayıcı */
.timer { display: flex; align-items: center; gap: 18px; background: var(--surface-2); border-radius: 16px; padding: 14px; flex-wrap: wrap; }
.timer-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.timer.finished .ring-fg { stroke: #22c55e; }
.timer-text { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.timer-controls { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 200px; }
.timer-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.timer-presets button { border: 1px solid var(--border); background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.timer-presets button.active { background: var(--accent); color: #fff; border-color: transparent; }
.timer-buttons { display: flex; gap: 8px; }
.reactions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.react { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 10px 14px; border-radius: 12px; font-weight: 600; transition: var(--transition); }
.react:hover { transform: translateY(-1px); }
.react.voted { border-color: var(--accent); }
.reactions .btn-outline { margin-left: auto; }

.empty { text-align: center; color: var(--text); padding: 20px; }
.empty p { margin: 6px 0; }

/* ========== Düğmeler ========== */
.btn { border: 0; padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: .92rem; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 20px rgba(255,61,129,.3); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-lg { padding: 15px 24px; font-size: 1.05rem; }

/* ========== Çekmeceler ========== */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(400px, 92vw); background: var(--bg2); border-left: 1px solid var(--border); z-index: 60; transform: translateX(105%); transition: transform .35s var(--transition); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 16px 20px 40px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.drawer-body h4 { margin: 12px 0 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.drawer-foot { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .3s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: transparent; color: var(--text); padding: 7px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; transition: var(--transition); display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--cat); border-color: transparent; color: #fff; }
.range-row { display: flex; gap: 12px; }
.range-row label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); flex: 1; }
select, input[type=number], input[type=text] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
select option { color: #000; }
.switch { display: flex; gap: 10px; align-items: center; font-size: .9rem; padding: 6px 0; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 12px; cursor: pointer; transition: var(--transition); }
.list li:hover { background: var(--surface-2); }
.list .li-icon { font-size: 1.4rem; }
.list .li-body { flex: 1; min-width: 0; }
.list .li-body b { display: block; }
.list .li-body small { color: var(--muted); }
.list .li-x { background: transparent; border: 0; color: var(--muted); font-size: 1rem; }
.list .li-x:hover { color: var(--accent); }
.list:empty::after { content: 'Henüz kayıt yok.'; color: var(--muted); font-size: .9rem; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 80px); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: .9rem; z-index: 90; opacity: 0; transition: var(--transition); pointer-events: none; }
.toast.show { transform: translateX(-50%); opacity: 1; }
.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 20px; }
kbd { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); font-family: inherit; }

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .brand h1 { font-size: 1.2rem; }
  .meters { grid-template-columns: 1fr 1fr; }
  .roll-btn { padding: 16px 40px; font-size: 1.05rem; width: 100%; }
  .reactions .btn-outline { margin-left: 0; width: 100%; }
  .card-media img { max-height: 55vh; }
  .foot { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
