/* Vampir Köylü — gece temalı varsayılan, açık tema seçeneği */
:root {
  --bg: #120a1c; --bg-soft: #1c1229; --card: #1b1127; --text: #efe9f7; --muted: #a79bbd; --line: #332545;
  --primary: #a56bff; --primary-d: #8f52f0; --primary-bg: #2a1a45; --accent: #e23a5a; --accent-bg: #3a1522;
  --ok: #3ddc84; --ok-bg: #11301f; --bad: #ff5c7a; --bad-bg: #3a1520; --warn: #f5c05a; --warn-bg: #3a2c10;
  --radius: 14px; --shadow: 0 10px 30px rgba(0, 0, 0, .35); --grad-a: #170d24; --grad-b: #0e0816; --code-bg: #3a2a55;
  --night-a: #0a0614; --night-b: #16092a;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4eff9; --bg-soft: #ece5f5; --card: #ffffff; --text: #1d1530; --muted: #6b6180; --line: #e2dbec;
  --primary: #7c3aed; --primary-d: #6a2ed0; --primary-bg: #efe6ff; --accent: #c81e3c; --accent-bg: #fde7ec;
  --ok: #16a34a; --ok-bg: #e7f7ec; --bad: #dc2626; --bad-bg: #fde8e8; --warn: #9a6700; --warn-bg: #fff4d6;
  --shadow: 0 10px 30px rgba(40, 20, 70, .10); --grad-a: #f8f4fc; --grad-b: #f0e9f7; --code-bg: #2a1d40; --night-a: #ded3f0; --night-b: #cbbde6;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: linear-gradient(180deg, var(--grad-a) 0%, var(--grad-b) 100%); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh; transition: background .6s ease;
}
body.phase-night { background: linear-gradient(180deg, var(--night-a) 0%, var(--night-b) 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: var(--primary); }
.hidden { display: none !important; }
.center { text-align: center; }
.mt12 { margin-top: 12px; }

.app { max-width: 1040px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.topbar .brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.topbar .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.topbar .meta b { color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line); }
.chip.code { background: var(--code-bg); color: #fff; letter-spacing: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.card h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.readonly-note { font-size: 13px; color: var(--muted); }

.home { max-width: 460px; margin: 6vh auto 0; text-align: center; position: relative; }
.home .logo { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 10px; box-shadow: 0 0 0 6px var(--accent-bg); }
.home-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
input[type=text], select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(165, 107, 255, .2); }
input.code { text-align: center; letter-spacing: 6px; font-size: 20px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--text); font-weight: 600; transition: transform .1s ease, background .15s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-d); }
.btn.bad { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #08210f; }
.btn.block { width: 100%; }
.btn.big { padding: 18px 22px; font-size: 18px; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.iconbtn { border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--text); border-radius: 10px; width: 38px; height: 38px; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.links { margin-top: 14px; font-size: 13px; }
.links button { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 0; font-size: 13px; }
.counter { display: flex; justify-content: center; gap: 18px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.counter b { color: var(--text); font-size: 16px; }
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 4px; text-align: left; }
.howto .step { padding: 10px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); }
.howto .step .ic { font-size: 22px; line-height: 1.2; }
.howto .step b { display: block; font-size: 12px; margin-top: 4px; }
.howto .step small { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }
.notice { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }

/* Lobi */
.lobby { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plist li:last-child { border-bottom: 0; }
.plist .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist li.dead .name { color: var(--muted); text-decoration: line-through; }
.plist .tag { font-size: 12px; color: var(--muted); white-space: nowrap; }
.plist .tag.ok { color: var(--ok); }
.plist .tag.role { color: var(--text); }
.plist .kick { border: 0; background: none; color: var(--bad); font-size: 16px; padding: 0 4px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.host-only { display: none; }
.is-host .host-only { display: initial; }
.is-host .row.host-only { display: flex; }
.settings-summary { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.settings-summary span { flex: 1; }
.guest #settingsSummary { display: flex; }
.guest #hostSettings { display: none; }
.guest.show-settings #hostSettings { display: block; }
.autorow { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.autorow input { width: 18px; height: 18px; }
.rolegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.rolerow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg-soft); font-size: 14px; }
.rolerow.vampire { border-color: var(--accent); }
.rolerow.zero { opacity: .55; }
.rolerow .ic { font-size: 20px; width: 26px; text-align: center; }
.rolerow .rn { flex: 1; font-weight: 600; min-width: 0; }
.rolerow .rn small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.rolerow .step { display: flex; align-items: center; gap: 4px; }
.rolerow .step button { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; padding: 0; }
.rolerow .step b { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }

/* Oyun */
.game { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.side { display: flex; flex-direction: column; gap: 14px; }
.phase-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.phase-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.phase-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.phase-time.low { color: var(--bad); }
.timer { position: relative; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 4px 0 12px; }
.timer i { display: block; height: 100%; background: var(--primary); width: 100%; transition: width .5s linear; }
.timer.low i { background: var(--bad); }

.rolecard-big { position: relative; border-radius: 16px; padding: 26px 16px; text-align: center; min-height: 190px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; user-select: none; border: 2px solid var(--line); background: var(--bg-soft); }
.rolecard-big.hiddencard { background: repeating-linear-gradient(135deg, var(--bg-soft) 0 10px, var(--line) 10px 12px); }
.rolecard-big.hiddencard .hint { font-size: 17px; font-weight: 700; }
.rolecard-big .ic { font-size: 56px; line-height: 1.1; }
.rolecard-big .rn { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0; }
.rolecard-big .team { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rolecard-big .desc { font-size: 14px; color: var(--muted); margin-top: 8px; max-width: 420px; margin-left: auto; margin-right: auto; }
.rolecard-big .mates { margin-top: 10px; font-size: 14px; }
.rolecard-big .hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.rolecard-big.vampire { border-color: var(--accent); background: var(--accent-bg); }
.rolecard-big.vampire .rn { color: var(--bad); }
.rolecard-big.village { border-color: var(--primary); background: var(--primary-bg); }
.rolecard-big.solo { border-color: var(--warn); background: var(--warn-bg); }

.mycard { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.mycard .ic { font-size: 34px; }
.mycard .rn { font-weight: 800; font-size: 16px; }
.mycard .st { font-size: 12px; color: var(--muted); }
.mycard.dead { opacity: .7; }
.mycard .intel { width: 100%; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; }
.mycard .intel li { padding: 3px 0; border-top: 1px dashed var(--line); }
.mycard { flex-wrap: wrap; }

.instr { font-size: 17px; font-weight: 700; margin: 4px 0 10px; }
.instr small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.targets button { padding: 14px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg-soft); color: var(--text); font-weight: 600; font-size: 15px; text-align: left; display: flex; align-items: center; gap: 8px; min-width: 0; }
.targets button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.targets button small { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.targets button.on { border-color: var(--primary); background: var(--primary-bg); }
.targets button.kill.on { border-color: var(--accent); background: var(--accent-bg); }
.waiting { text-align: center; padding: 26px 10px; }
.waiting .ic { font-size: 54px; line-height: 1.1; animation: float 3s ease-in-out infinite; }
.waiting .t { font-size: 20px; font-weight: 800; margin-top: 8px; }
.waiting .s { color: var(--muted); font-size: 14px; margin-top: 4px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.resultbox { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--bg-soft); border: 2px solid var(--line); text-align: center; font-size: 17px; font-weight: 700; }
.resultbox.vamp { border-color: var(--accent); color: var(--bad); }
.resultbox.inno { border-color: var(--ok); color: var(--ok); }
.matepicks { margin: 8px 0 12px; font-size: 13px; color: var(--muted); }
.matepicks b { color: var(--text); }
.report { padding: 14px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); margin-bottom: 12px; }
.report .rt { font-weight: 800; margin-bottom: 4px; }
.report p { margin: 2px 0; font-size: 14px; }
.votelist li { padding: 6px 0; }
.votebtn { padding: 8px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--text); font-weight: 600; font-size: 13px; white-space: nowrap; }
.votebtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tally { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.tally b { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--primary-bg); color: var(--primary); font-size: 12px; }
.voters { font-size: 11px; color: var(--muted); display: block; width: 100%; padding-left: 4px; }
.plist li.wrap { flex-wrap: wrap; }

.end { text-align: center; }
.end .trophy { font-size: 60px; line-height: 1.1; }
.end .big { font-size: 28px; font-weight: 800; margin: 6px 0; }
.end .big.village { color: var(--primary); } .end .big.vampire { color: var(--bad); } .end .big.other { color: var(--warn); }
.rolelist { list-style: none; padding: 0; margin: 12px 0; text-align: left; }
.rolelist li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rolelist li.won { color: var(--ok); font-weight: 700; }
.rolelist li.dead span:first-child { text-decoration: line-through; opacity: .7; }
.events { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; font-size: 13px; }
.events li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.events li b { display: block; font-size: 12px; color: var(--muted); }
.events .empty { color: var(--muted); }

/* Geçiş katmanı */
.overlay { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 4, 16, .92); color: #fff; text-align: center; }
.overlay.show { display: flex; animation: ovin .3s ease; }
.ov-icon { font-size: 70px; line-height: 1.1; }
.ov-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0; }
.ov-lines { font-size: 17px; opacity: .92; max-width: 520px; }
.ov-lines p { margin: 4px 0; }
.ov-hint { margin-top: 18px; font-size: 12px; opacity: .6; }
@keyframes ovin { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(8, 4, 16, .6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal.show { display: flex; }
.modal .box { background: var(--card); border-radius: 14px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal h2 { margin-top: 0; }
.rules p { margin: 0 0 8px; font-size: 14px; }
.rules .rl { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rules .rl .ic { font-size: 22px; width: 30px; text-align: center; }
.rules .rl b { display: block; }
.rules .rl small { color: var(--muted); }
.rules h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0 10px; }
footer a { color: var(--muted); }

@media (max-width: 760px) {
  .lobby, .game { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .settings { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; } .howto .step { display: flex; gap: 10px; align-items: center; } .howto .step .ic { font-size: 24px; }
  .phase-title { font-size: 19px; } .phase-time { font-size: 26px; }
  .targets { grid-template-columns: 1fr 1fr; }
  .rolecard-big .rn { font-size: 26px; }
  .ov-title { font-size: 24px; } .ov-lines { font-size: 15px; }
  .topbar .meta { display: none; }
}
