/* connections.hoshibi.de – flach, Hoshibi Dark. Keine Inline-Styles (CSP), Farben als Variablen. */
:root {
  --bg: #09090b; --bar: #0d0f14; --surf: #11131a; --raise: #161922; --raise2: #1c202b;
  --line: rgba(255, 255, 255, .08); --line2: rgba(255, 255, 255, .16);
  --tx: #f4f4f6; --mute: #9ca3af;
  --accent: #5fb4c9;
  --l0: #c9a227; --l1: #4f9d69; --l2: #4a86c9; --l3: #8b6fc9; --on: #0b0d12; --on3: #fff;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--tx); font: 16px/1.5 var(--sans); }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--tx); color: var(--bg); padding: 8px 12px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Kopf */
.top { background: var(--bar); border-bottom: 1px solid var(--line); }
.top-in { max-width: 600px; margin: 0 auto; height: 52px; padding: 0 12px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.mark { width: 26px; height: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--surf); border: 1px solid var(--line2); border-radius: 4px; }
.mark i { border-radius: 1px; }
.mark i:nth-child(1) { background: var(--l0); } .mark i:nth-child(2) { background: var(--l1); }
.mark i:nth-child(3) { background: var(--l2); } .mark i:nth-child(4) { background: var(--l3); }
.eco { display: flex; gap: 14px; margin-left: 6px; font-size: 14px; }
.eco a { color: var(--mute); text-decoration: none; padding: 4px 0; }
.eco a:hover { color: var(--tx); }
.tools { margin-left: auto; display: flex; gap: 2px; }
.ic { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 4px; color: var(--mute); }
.ic:hover { color: var(--tx); background: var(--raise); }
.ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Leiste */
.bar { max-width: 600px; width: 100%; margin: 0 auto; padding: 12px 12px 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 4px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 7px 14px; color: var(--mute); font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button[aria-pressed="true"] { background: var(--raise2); color: var(--tx); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg.small { margin-bottom: 8px; }
.meta { margin-left: auto; color: var(--mute); font-size: 13px; }

/* Spiel */
main { flex: 1; width: 100%; max-width: 600px; margin: 0 auto; padding: 8px 12px 20px; position: relative; }
.view { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ptitle { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--mute); text-align: center; align-self: stretch; }
.banner { width: 100%; border: 1px solid var(--line2); border-left: 3px solid var(--l0); background: var(--surf); padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--tx); color: var(--bg); padding: 8px 14px; border-radius: 4px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.toast.on { opacity: 1; }

.board { width: 100%; display: grid; gap: 8px; }
.sol { border-radius: 4px; padding: 12px 8px; text-align: center; color: var(--on); display: flex; flex-direction: column; justify-content: center; min-height: 72px; animation: rise .25s ease-out; }
.sol b { text-transform: uppercase; letter-spacing: .04em; font-size: 15px; }
.sol span { font-size: 14px; margin-top: 2px; }
.sol .sym { display: none; }
.hc .sol .sym { display: inline; margin-right: 6px; }
.l0 { background: var(--l0); } .l1 { background: var(--l1); } .l2 { background: var(--l2); } .l3 { background: var(--l3); color: var(--on3); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { min-height: 72px; padding: 6px 4px; background: var(--raise2); border: 2px solid transparent; border-radius: 4px; font-weight: 700; font-size: clamp(12px, 3.6vw, 16px); text-transform: uppercase; letter-spacing: .02em; line-height: 1.15; display: grid; place-items: center; overflow-wrap: anywhere; hyphens: auto; user-select: none; touch-action: manipulation; }
.tile:hover { background: #262b39; }
.tile[aria-pressed="true"] { background: #e9e9ee; color: #0b0d12; }
.tile.shake { animation: shake .4s; }
.tile.hop { animation: hop .25s; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes hop { 50% { transform: translateY(-6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
:root.noanim *, :root.noanim *::before { animation: none !important; transition: none !important; }

.lives { color: var(--mute); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--mute); }
.dots i.off { background: transparent; border: 2px solid var(--line2); }
.ctrl { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ctrl .btn { min-width: 108px; }
.btn { background: var(--raise); border: 1px solid var(--line2); border-radius: 4px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.btn:hover { background: var(--raise2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #07151a; }
.btn.pri:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: #f2998a; }
.btn.danger.armed { background: #6e2a20; color: #fff; border-color: #6e2a20; }
.btn.sm { padding: 6px 10px; font-size: 13px; }

.after { width: 100%; border: 1px solid var(--line); background: var(--surf); padding: 14px; text-align: center; }
.after-res { font-weight: 700; margin-bottom: 10px; }
.after-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.after-btns.left { justify-content: flex-start; }
.after-next { margin-top: 10px; color: var(--mute); font-size: 14px; }

/* Listen */
.view p.muted { align-self: stretch; margin: 0; }
.view .after-btns.left { align-self: stretch; }
.plist { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 8px; background: var(--surf); border: 1px solid var(--line); border-radius: 4px; padding: 8px 8px 8px 14px; flex-wrap: wrap; }
.plist .nm { flex: 1 1 140px; font-weight: 600; text-align: left; background: none; border: 0; padding: 6px 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.plist .nm small { display: block; font-weight: 400; color: var(--mute); font-size: 12px; }
.plist .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.plist .st { font: 12px var(--mono); color: var(--mute); }
.plist .st.won { color: var(--l1); } .plist .st.lost { color: #f2998a; }
.empty { color: var(--mute); text-align: center; padding: 18px 8px; border: 1px dashed var(--line2); width: 100%; }

.foot { border-top: 1px solid var(--line); background: var(--bar); padding: 12px; display: flex; gap: 8px 16px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--mute); }
.foot a { color: var(--mute); }
.foot a:hover { color: var(--tx); }

/* Dialoge */
dialog { background: var(--surf); color: var(--tx); border: 1px solid var(--line2); border-radius: 6px; padding: 0; width: calc(100% - 24px); max-width: 440px; max-height: calc(100dvh - 24px); overflow: auto; }
dialog.wide { max-width: 560px; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dh { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surf); z-index: 1; }
.dh h2 { margin: 0; font-size: 17px; }
.db { padding: 14px 16px 18px; }
.db h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.db p { margin: 0 0 10px; }
.rules { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.chip { padding: 1px 7px; border-radius: 3px; font-size: 13px; font-weight: 600; color: var(--on); }
.chip.l3 { color: var(--on3); }
.muted { color: var(--mute); font-size: 14px; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.nums div { display: flex; flex-direction: column; text-align: center; border: 1px solid var(--line); padding: 10px 4px; }
.nums dt { color: var(--mute); font-size: 11px; order: 2; text-transform: uppercase; letter-spacing: .04em; }
.nums dd { margin: 0; font: 700 20px var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dist { display: grid; gap: 4px; margin-bottom: 14px; }
.dist .r { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font: 13px var(--mono); font-variant-numeric: tabular-nums; }
.dist .bar2 { background: var(--raise2); min-width: 22px; padding: 1px 6px; text-align: right; font-weight: 700; }
.dist .bar2.hit { background: var(--accent); color: #07151a; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.opt small { display: block; color: var(--mute); font-size: 13px; }
.opt input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* Editor */
.fld { display: grid; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--mute); }
input[type=text] { width: 100%; background: var(--bg); color: var(--tx); border: 1px solid var(--line2); border-radius: 4px; padding: 9px 10px; font: inherit; font-size: 15px; min-width: 0; }
input[type=text]:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.eg { border: 1px solid var(--line); border-left: 6px solid var(--line2); border-radius: 4px; padding: 10px; margin-bottom: 10px; display: grid; gap: 8px; }
.eg.l0 { border-left-color: var(--l0); background: none; } .eg.l1 { border-left-color: var(--l1); background: none; }
.eg.l2 { border-left-color: var(--l2); background: none; } .eg.l3 { border-left-color: var(--l3); background: none; }
.eg .lv { font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.eg .ws { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.err { color: #f2998a; font-size: 14px; }
.eg input.bad { border-color: #f2998a; }

@media (max-width: 420px) { .eco { display: none; } .meta { width: 100%; margin-left: 0; } .ctrl .btn { min-width: 0; flex: 1 1 0; } }
@media (min-width: 480px) { .eg .ws { grid-template-columns: repeat(4, 1fr); } .tile, .sol { min-height: 80px; } }
