/* ───────── Колесо Фортуни · темна «оксамитова» тема ───────── */

:root {
  --bg: #100a15;
  --bg-2: #1a1020;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .07);
  --panel-deep: #150e1c;
  --line: rgba(233, 199, 122, .18);
  --line-soft: rgba(255, 255, 255, .08);
  --text: #f4ecf3;
  --muted: #b3a2b8;
  --gold: #e9c77a;
  --gold-dim: #b9974f;
  --rose: #ef8fb4;
  --fig-a: #f79cbe;
  --fig-b: #79d6d0;
  --prop: rgba(233, 199, 122, .32);
  --r: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* фон + тонка «тканинна» текстура окремим фіксованим шаром */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .014) 0 2px, transparent 2px 4px),
    radial-gradient(1100px 620px at 12% -8%, rgba(239, 143, 180, .20), transparent 60%),
    radial-gradient(900px 560px at 92% 6%, rgba(121, 214, 208, .13), transparent 62%),
    radial-gradient(800px 700px at 50% 108%, rgba(233, 199, 122, .11), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0; }

button, input, select { font: inherit; color: inherit; }

/* ───────── Ворота 18+ ───────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 6, 14, .78);
  backdrop-filter: blur(14px);
}
.gate-card {
  max-width: 440px;
  padding: 34px 30px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  box-shadow: var(--shadow);
}
.gate-mark {
  display: inline-block;
  padding: 6px 14px;
  margin-bottom: 18px;
  font: 600 13px/1 var(--sans);
  letter-spacing: .18em;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.gate-card h1 { font-size: 34px; margin-bottom: 12px; }
.gate-card p { color: var(--muted); line-height: 1.6; font-size: 15px; }
.gate-actions { display: flex; gap: 10px; justify-content: center; margin: 22px 0 14px; flex-wrap: wrap; }
.gate-remember { font-size: 13px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }

/* ───────── Каркас ───────── */
.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 18px 60px;
  position: relative;
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  font-size: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.brand h1 { font-size: 25px; line-height: 1.1; }
.brand-sub {
  margin: 3px 0 0;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.top-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: .18s;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); transform: translateY(-1px); }
.icon-btn.is-off { opacity: .4; }
.icon-btn.is-on { color: var(--rose); border-color: rgba(239, 143, 180, .5); }

/* Таби */
.tabs {
  display: flex;
  gap: 4px;
  margin: 22px 0 18px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
}
.tab {
  flex: 1;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: .18s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: #1a1020;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  font-weight: 600;
}

.view { display: none; }
.view.is-active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ───────── Фільтри ───────── */
.filters {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--panel);
  overflow: hidden;
}
.filters summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  list-style: none;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "⌄"; margin-left: auto; color: var(--muted); }
.filters[open] summary::after { content: "⌃"; }
.pool-count { font-size: 12px; color: var(--gold-dim); margin-left: auto; margin-right: 12px; }
.filter-body { padding: 4px 18px 18px; display: grid; gap: 16px; }
.filter-row { display: grid; gap: 8px; }
.filter-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.filter-label b { color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 13px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: .16s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.is-on {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
  box-shadow: inset 0 0 0 1px rgba(233, 199, 122, .12);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-dim), rgba(255, 255, 255, .12));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #1a1020;
  cursor: pointer;
}

.set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.set-bulk-info { font-size: 12px; color: var(--gold-dim); margin-right: auto; }
.mini-btn.wide { width: 100%; }

.switches { display: flex; flex-wrap: wrap; gap: 14px; }
.sw { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.sw input { display: none; }
.sw span {
  width: 38px; height: 21px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--line-soft);
  position: relative;
  transition: .2s;
}
.sw span::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--muted);
  transition: .2s;
}
.sw input:checked + span { background: rgba(233, 199, 122, .3); border-color: var(--line); }
.sw input:checked + span::after { transform: translateX(17px); background: var(--gold); }

/* ───────── Кнопки ───────── */
.btn {
  padding: 11px 20px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  cursor: pointer;
  transition: .18s;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--panel-2); transform: translateY(-1px); }
.btn-primary {
  color: #1a1020;
  font-weight: 600;
  border: 0;
  background: linear-gradient(180deg, #f4d68f, var(--gold-dim));
  box-shadow: 0 8px 26px rgba(233, 199, 122, .22);
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }

/* ───────── Колесо ───────── */
.wheel-wrap {
  position: relative;
  width: min(460px, 92vw);
  margin: 26px auto 0;
  aspect-ratio: 1;
}
#wheel {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, .55));
}
.spin-btn {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 21%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(233, 199, 122, .55);
  background: radial-gradient(circle at 32% 28%, #2c2035, #140d1a);
  color: var(--gold);
  cursor: pointer;
  transition: .2s;
}
.spin-btn-txt { font-size: clamp(9px, 2.1vw, 12px); letter-spacing: .1em; font-weight: 600; }
.spin-btn:hover:not(:disabled) { box-shadow: 0 0 0 6px rgba(233, 199, 122, .1), 0 0 32px rgba(233, 199, 122, .3); }
.spin-btn:active:not(:disabled) { transform: translate(-50%, -50%) scale(.95); }
.spin-btn:disabled { opacity: .55; cursor: default; }

.wheel-note { text-align: center; font-size: 12px; color: var(--muted); margin: 14px 0 0; min-height: 18px; }

/* ───────── Результат ───────── */
.result {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .45s cubic-bezier(.2, .9, .25, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }

.result-art {
  background:
    radial-gradient(500px 260px at 50% 120%, rgba(239, 143, 180, .16), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, .28), transparent);
  border-bottom: 1px solid var(--line-soft);
}
.scene { display: block; width: 100%; }
.result-art .scene { max-height: 300px; max-width: 470px; margin: 0 auto; padding: 6px 0; }
.scene .fig { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); }

.result-body { padding: 20px 22px 22px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.result-head h2 { font-size: 27px; }
.aka { margin: 4px 0 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-dim); }
.result-btns { display: flex; gap: 7px; flex-shrink: 0; }

.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 0; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge .pips { letter-spacing: 2px; color: var(--gold); }
.badge .pips .off { color: rgba(255, 255, 255, .18); }

.desc { margin: 16px 0 0; line-height: 1.65; color: #e6dbe6; }
.tip {
  margin: 14px 0 0;
  padding: 12px 14px 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #ecd9c9;
  border-left: 2px solid var(--gold-dim);
  border-radius: 0 12px 12px 0;
  background: rgba(233, 199, 122, .07);
}
.tip::before { content: "Порада · "; color: var(--gold-dim); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

.mod {
  margin-top: 14px;
  padding: 13px 16px;
  border: 1px dashed rgba(239, 143, 180, .4);
  border-radius: 14px;
  background: rgba(239, 143, 180, .07);
}
.mod-label { display: block; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--rose); margin-bottom: 5px; }
.mod-text { font-family: var(--serif); font-size: 17px; }

.timer { margin-top: 16px; text-align: center; }
.timer-time { font-family: var(--serif); font-size: 40px; letter-spacing: .04em; color: var(--gold); }
.timer-btns { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.timer-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--rose), var(--gold)); transition: width .4s linear; }
.timer.is-done .timer-time { color: var(--rose); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.result-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ───────── Каталог ───────── */
.catalog-tools { display: grid; gap: 12px; margin-bottom: 18px; }
#search {
  padding: 12px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
  outline: none;
}
#search:focus { border-color: var(--line); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
  transition: .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--line); box-shadow: 0 14px 34px rgba(0, 0, 0, .4); }
.card.is-muted { opacity: .42; }
.card .scene { background: linear-gradient(180deg, rgba(0, 0, 0, .25), transparent); }
.card-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.card-body h3 { font-size: 17px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.card-meta .dot { width: 7px; height: 7px; border-radius: 50%; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line-soft); border-radius: 999px; }
.card-btns { display: flex; gap: 6px; margin-top: 2px; }
.mini-btn {
  flex: 1;
  padding: 6px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: .16s;
}
.mini-btn:hover { color: var(--text); border-color: var(--line); }
.mini-btn.is-on { color: var(--rose); border-color: rgba(239, 143, 180, .45); }

/* ───────── Історія ───────── */
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.history-head h2 { font-size: 21px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
  font-size: 14px;
}
.history .h-time { margin-left: auto; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.history .h-mod { font-size: 12px; color: var(--rose); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* Спалах на результат */
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.flash i {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 2px;
  animation: fall 1.5s ease-in forwards;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0); opacity: 1; }
  to { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

@media (max-width: 560px) {
  .brand h1 { font-size: 21px; }
  .result-body { padding: 16px 16px 18px; }
  .result-head h2 { font-size: 23px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
