/* Общие стили аукциона: палитры категорий, карточка лота, фото, плеер, барабан. Извлечено из random-picker/index.html */

  :root {
    /* тема своя и только тёмная: «принудительная тёмная тема» Samsung/Chrome её не перекрашивает */
    color-scheme: dark;
    --bg: #08080c;
    --text: #f4f2ff;
    --muted: rgba(244, 242, 255, .68); /* .55 не читалось с дивана и на солнце */
    --glass: rgba(255, 255, 255, .06);
    --glass-line: rgba(255, 255, 255, .12);
    --c1: #8b5cf6;
    --c2: #ec4899;
    --c3: #22d3ee;
    --display: "Unbounded", "Arial Black", system-ui, sans-serif;
    --body: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }
  /* палитра категории: действует и на body (фон, карточка), и на саму кнопку категории */
  [data-kind="artist"]     { --c1: #d946ef; --c2: #7c3aed; --c3: #fb7185; }
  [data-kind="film"]       { --c1: #f43f5e; --c2: #be123c; --c3: #fda4af; }
  [data-kind="series"]     { --c1: #a78bfa; --c2: #22d3ee; --c3: #f0abfc; }
  [data-kind="person"]     { --c1: #fbbf24; --c2: #f59e0b; --c3: #fde68a; }
  [data-kind="character"]  { --c1: #f0abfc; --c2: #c026d3; --c3: #fde047; }
  [data-kind="food"]       { --c1: #f97316; --c2: #facc15; --c3: #ef4444; }
  [data-kind="city"]       { --c1: #06b6d4; --c2: #3b82f6; --c3: #34d399; }
  [data-kind="country"]    { --c1: #2dd4bf; --c2: #0d9488; --c3: #a7f3d0; }
  [data-kind="place"]      { --c1: #818cf8; --c2: #4f46e5; --c3: #c4b5fd; }
  [data-kind="animal"]     { --c1: #22c55e; --c2: #a3e635; --c3: #14b8a6; }
  [data-kind="painting"]   { --c1: #e7a86b; --c2: #b45309; --c3: #fde68a; }
  [data-kind="company"]    { --c1: #94a3b8; --c2: #e2e8f0; --c3: #38bdf8; }
  [data-kind="club"]       { --c1: #ef4444; --c2: #2563eb; --c3: #f8fafc; }
  [data-kind="profession"] { --c1: #fdba74; --c2: #c2410c; --c3: #fef3c7; }
  [data-kind="invention"]  { --c1: #67e8f9; --c2: #6366f1; --c3: #e0e7ff; }

  * { box-sizing: border-box; }
  /* никаких системных контролов: ни спиннеров у number, ни системной стрелки у select */
  input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
  input[type="number"]::-webkit-outer-spin-button,
  input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  select { -webkit-appearance: none; appearance: none; }
  /* manipulation — без зума двойным тапом (на iOS второй тап по «Перебить» увеличивал страницу) */
  html { background: var(--bg); touch-action: manipulation; }
  body {
    margin: 0;
    height: 100vh; height: 100dvh;
    overscroll-behavior-y: none; /* потянул вниз во время торгов — страница не перезагружается */
    color: var(--text);
    font: 16px/1.55 var(--body);
    padding: 18px;
    overflow: hidden;
    position: relative;
  }

  /* iOS < 15.4 не знает dvh, а 100vh там выше видимой области — низ (кнопки ставок) уезжал под панель */
  @supports not (height: 100dvh) {
    html { height: -webkit-fill-available; }
    body { height: -webkit-fill-available; }
  }

  /* фон: плавающие цветные пятна + зерно */
  .bg { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; overflow: hidden; pointer-events: none; }
  .blob {
    position: absolute;
    width: 55vmax; height: 55vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .38;
    transition: background 1s ease;
    will-change: transform;
  }
  .blob.a { background: var(--c1); top: -22vmax; left: -14vmax; animation: drift1 22s ease-in-out infinite alternate; }
  .blob.b { background: var(--c2); bottom: -28vmax; right: -16vmax; animation: drift2 26s ease-in-out infinite alternate; }
  .blob.c { background: var(--c3); top: 35%; left: 45%; width: 32vmax; height: 32vmax; opacity: .2; animation: drift3 30s ease-in-out infinite alternate; }
  @keyframes drift1 { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
  @keyframes drift2 { to { transform: translate(-12vmax, -14vmax) scale(1.1); } }
  @keyframes drift3 { to { transform: translate(-20vmax, 8vmax) scale(1.3); } }
  .grain {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: .13; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  /* блок продажи в карточке лота */
  .sale { flex: none; margin: 0 0 14px; padding: 12px 14px; border: 1px dashed var(--glass-line); border-radius: 16px; }
  .sale-lot { font-size: 14px; margin-bottom: 8px; color: var(--muted); }
  .sale-lot b { color: var(--text); font-weight: 600; }
  .sold-row { display: flex; align-items: center; gap: 12px; }
  .sale-cap { font: 700 10.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
  .sale-hint { font-size: 14px; color: var(--muted); }
  .who { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .who button {
    font: 500 13.5px var(--body); color: var(--text);
    background: rgba(255, 255, 255, .06); border: 1px solid var(--glass-line); border-radius: 999px;
    padding: 6px 12px; cursor: pointer; transition: border-color .15s, background .15s;
  }
  .who button small { color: var(--muted); margin-left: 5px; font-size: 12px; }
  .who button:hover { border-color: var(--c1); }
  .who button.on { background: linear-gradient(120deg, var(--c1), var(--c2)); color: #0a0a0f; border-color: transparent; background-origin: border-box; font-weight: 600; }
  .who button.on small { color: rgba(10, 10, 15, .65); }
  .sale-row { display: flex; gap: 8px; }
  .sale-row .money-input { flex: 1; }
  .sale-row .money-input input { width: 100%; }
  .sale-row .btn { padding: 0 18px; font-size: 12px; }
  .sale-err { color: #ff8a8a; font-size: 13px; }
  .sale-err:not(:empty) { margin-top: 8px; }
  .sale.shake { animation: shake .35s; }
  @keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
  .sale.sold { border-style: solid; border-color: color-mix(in srgb, var(--c1) 60%, transparent); background: color-mix(in srgb, var(--c1) 10%, transparent); }
  /* «ПРОДАНО» — одна печать на все экраны (старт, доска, соло): рамка 1.5px, наклон -7°, цвет --c3 */
  .sold-stamp { font: 900 12px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--c3); border: 1.5px solid var(--c3); border-radius: 8px; padding: 6px 8px; transform: rotate(-7deg); animation: stamp .45s cubic-bezier(.3, 1.8, .5, 1) both; }
  @keyframes stamp { from { opacity: 0; transform: rotate(-7deg) scale(2.2); } }

  /* молоток-маркер события: тот же жест, что на стартовом экране */
  .gavel-mark { font-size: 20px; line-height: 1; display: inline-block; transform: rotate(-32deg); transform-origin: 75% 85%; position: relative; animation: strike .6s cubic-bezier(.3, 1.4, .5, 1); }
  .gavel-mark::after { content: ""; position: absolute; left: 50%; top: 88%; width: 1.5em; height: 1.5em; margin: -.75em 0 0 -.75em; border-radius: 50%; border: 2px solid var(--c1); opacity: 0; animation: shock .6s ease-out; }
  @keyframes strike { 0% { transform: rotate(-32deg); } 30% { transform: rotate(-58deg); } 52% { transform: rotate(6deg); } 70% { transform: rotate(-16deg); } 100% { transform: rotate(-32deg); } }
  @keyframes shock { 0%, 45% { opacity: 0; transform: scale(.2); } 60% { opacity: .85; } 100% { opacity: 0; transform: scale(2.4); } }

  /* лента «фишек» — выбор категории; общая для стартового экрана и лобби доски */
  .tiles { display: flex; flex-wrap: wrap; gap: 7px; }
  .tile {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 13px 8px 10px; border-radius: 999px;
    border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .045);
    cursor: pointer; color: rgba(244, 242, 255, .88);
    font: 700 11px/1 var(--display); text-transform: uppercase; letter-spacing: .01em;
    transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), border-color .2s, background .25s, box-shadow .3s, color .25s;
    animation: rise .6s both;
  }
  .tile .ico { font-size: 15px; line-height: 1; }
  .tile .n { font: 500 10.5px/1 var(--body); color: rgba(244, 242, 255, .6); text-transform: none; letter-spacing: 0; }
  .tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c1) 70%, transparent); background: rgba(255, 255, 255, .08); }
  .tile.on {
    color: #0a0a0f; border-color: transparent;
    background: linear-gradient(100deg, var(--c1), var(--c2) 75%, var(--c3)); background-origin: border-box;
    box-shadow: 0 12px 34px -14px var(--c1), inset 0 1px 0 rgba(255, 255, 255, .4);
  }
  .tile.on .n { color: rgba(10, 10, 15, .62); }
  /* пальцем: фишки и пилюли-пресеты дорастают до 44px, мышью остаются компактными */
  @media (pointer: coarse) {
    .tiles { gap: 8px; }
    .tile { min-height: 44px; padding: 8px 15px 8px 12px; }
    .tile .ico { font-size: 16px; }
  }

  .sold-text { flex: 1; font-size: 15px; }
  .sold-text b { font-weight: 600; }
  .sale.sold button.undo { font: 500 12px var(--body); color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
  .sale.sold button.undo:hover { color: var(--text); }

  header { margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  header .kbd { margin: 0; }
  h1 {
    font: 900 clamp(24px, 2.6vw, 34px)/1 var(--display);
    white-space: nowrap;
    letter-spacing: -.04em;
    margin: 0;
    text-transform: uppercase;
  }
  h1 em {
    font-style: normal;
    background: linear-gradient(100deg, var(--c1), var(--c2) 55%, var(--c3));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
  }

  /* карточка */
  .frame {
    position: relative;
    flex: 1 1 auto; min-height: 0;
    margin-top: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-line);
    border-radius: 28px;
    backdrop-filter: blur(24px);
    box-shadow: 0 30px 80px -40px #000;
    overflow: hidden;
  }
  .card {
    height: 100%;
    padding: 28px 28px 24px;
    display: flex; flex-direction: column;
    overflow-y: auto; scrollbar-width: thin; /* полоса появляется, только если карточка не влезла */
    border-radius: inherit;
  }
  .card.center, .card.loading { justify-content: center; }
  .frame::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: linear-gradient(140deg, var(--c1), transparent 35%, transparent 65%, var(--c2));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: .7; pointer-events: none; transition: opacity .4s;
  }
  .card.center { align-items: center; text-align: center; }
  .result > * { flex: none; }

  .hint { color: var(--muted); font-size: 15px; }
  .hint .big { font-size: 56px; display: block; margin-bottom: 12px; animation: bob 3s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-8px) rotate(8deg); } }

  /* загрузка — слот-машина */
  .slot-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
  .slot {
    font: 700 clamp(22px, 6vw, 34px)/1.15 var(--display);
    letter-spacing: -.02em;
    min-height: 2.4em; display: flex; align-items: center; justify-content: center;
    filter: blur(.6px); opacity: .9;
    background: linear-gradient(100deg, var(--c1), var(--c2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .bar { width: 160px; height: 3px; border-radius: 3px; background: var(--glass-line); margin-top: 18px; overflow: hidden; }
  .bar::after { content: ""; display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--c1), var(--c2)); animation: slide 1s ease-in-out infinite alternate; }
  @keyframes slide { from { transform: translateX(-60%); } to { transform: translateX(210%); } }

  /* результат */
  .result > *, .result .text > * { animation: rise .6s cubic-bezier(.2, .9, .3, 1) both; }
  .result .text > :nth-child(1) { animation-delay: 0s; }
  .result .text > :nth-child(2) { animation-delay: .06s; }
  .result .text > :nth-child(3) { animation-delay: .12s; }
  .result .text > :nth-child(4) { animation-delay: .18s; }
  .result .text > :nth-child(5) { animation-delay: .24s; }
  .result .text > :nth-child(6) { animation-delay: .3s; }
  .result .text > :nth-child(n+7) { animation-delay: .36s; }
  .result > .player, .result > .another { animation-delay: .42s; }
  .text { display: flex; flex-direction: column; min-width: 0; }
  .text > * { flex: none; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }

  .emoji {
    font-size: 72px; line-height: 1; margin-bottom: 18px; width: fit-content;
    filter: drop-shadow(0 12px 24px color-mix(in srgb, var(--c1) 60%, transparent));
  }
  .result .emoji { animation: pop .7s cubic-bezier(.3, 1.9, .5, 1) both; }
  @keyframes pop { from { opacity: 0; transform: scale(.3) rotate(-25deg); } }
  .kind { font: 700 11px/1 var(--display); text-transform: uppercase; letter-spacing: .16em; color: var(--c1); transition: color 1s; }
  .name {
    font: 900 clamp(30px, 8vw, 46px)/1.04 var(--display);
    letter-spacing: -.035em;
    margin: 10px 0 10px;
    background: linear-gradient(100deg, #fff 30%, color-mix(in srgb, var(--c2) 70%, white));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    overflow-wrap: anywhere;
  }
  .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
  .meta span { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--glass-line); color: var(--muted); }
  .desc { margin: 0 0 16px; font-size: 16.5px; color: rgba(244, 242, 255, .86); }
  .fact {
    margin: 0; padding: 14px 16px 14px 18px; font-size: 14.5px;
    background: rgba(255, 255, 255, .05);
    border-left: 3px solid var(--c1);
    border-radius: 4px 14px 14px 4px;
    color: rgba(244, 242, 255, .8);
  }
  .fact b { font: 700 10.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--c1); display: block; margin-bottom: 6px; }
  .error { color: #ff8a8a; font-size: 14px; white-space: pre-wrap; word-break: break-word; }

  /* фото из Википедии */
  .hero {
    position: relative;
    flex: none;
    margin: -28px -28px 20px;
    height: 230px;
    background: rgba(255, 255, 255, .04);
    overflow: hidden;
  }
  .hero::before { /* скелетон, пока грузится */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .08) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
  }
  @keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  .hero img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0; transform: scale(1.06);
    transition: opacity .7s ease, transform 1.4s cubic-bezier(.2, .8, .3, 1);
  }
  .hero.ready img { opacity: 1; transform: none; }
  .hero.ready::before { display: none; }
  .hero::after { /* плавный уход фото в карточку */
    content: ""; position: absolute; inset: auto 0 0 0; height: 55%;
    background: linear-gradient(to top, rgba(18, 17, 24, .92), transparent);
    pointer-events: none;
  }
  .hero a {
    position: absolute; right: 12px; top: 12px; z-index: 1;
    font-size: 11px; color: rgba(255, 255, 255, .85); text-decoration: none;
    background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px);
    border-radius: 999px; padding: 4px 10px;
    opacity: 0; transition: opacity .4s;
  }
  .hero.ready a { opacity: 1; }
  .hero a:hover { background: rgba(0, 0, 0, .7); }
  .hero .blur { filter: blur(28px) brightness(.55) saturate(1.3); transform: scale(1.3) !important; }
  .hero.poster { height: 300px; }
  .hero.poster img:not(.blur) { object-fit: contain; padding: 18px 0 26px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .6)); }
  .hero.logo { height: 200px; background: #f3f3f6; }
  .hero.logo img { object-fit: contain; padding: 38px 60px 46px; }
  .hero.logo::after { display: none; }
  .hero.gone { display: none; }
  /* эмодзи наезжает на фото */
  .hero:not(.gone) + .text > .emoji { margin-top: -62px; position: relative; z-index: 1; font-size: 64px; }

  /* плеер */
  .player {
    margin-top: 14px;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px 10px 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--glass-line);
    border-radius: 16px;
  }
  .player .toggle {
    flex: none; width: 42px; height: 42px; border-radius: 50%;
    border: 0; cursor: pointer;
    background: linear-gradient(140deg, var(--c1), var(--c2));
    color: #0a0a0f; font-size: 15px; line-height: 1;
    display: grid; place-items: center;
    transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
  }
  .player .toggle:hover { transform: scale(1.1); }
  .player .info { min-width: 0; flex: 1; }
  .player .cap { font: 700 10px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
  .player .song { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .eq { flex: none; display: flex; align-items: flex-end; gap: 3px; height: 22px; }
  .eq i { width: 3px; height: 100%; border-radius: 2px; background: var(--c1); transform-origin: bottom; transform: scaleY(.18); transition: transform .3s; }
  .player.playing .eq i { animation: eq .9s ease-in-out infinite alternate; }
  .player.playing .eq i:nth-child(2) { animation-duration: .6s; animation-delay: -.3s; }
  .player.playing .eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -.5s; }
  .player.playing .eq i:nth-child(4) { animation-duration: .75s; animation-delay: -.2s; }
  @keyframes eq { from { transform: scaleY(.18); } to { transform: scaleY(1); } }

  /* кнопка ДРУГОЙ */
  .another {
    position: relative;
    margin-top: 18px; width: 100%;
    font: 900 clamp(18px, 5vw, 24px)/1 var(--display);
    letter-spacing: .04em; text-transform: uppercase;
    color: #0a0a0f;
    background: linear-gradient(100deg, var(--c1), var(--c2) 60%, var(--c3));
    background-size: 180% 100%;
    border: 0; border-radius: 18px;
    padding: 16px 20px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 14px;
    box-shadow: 0 18px 50px -18px var(--c1), inset 0 1px 0 rgba(255, 255, 255, .45);
    transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background-position .5s, box-shadow .3s;
    overflow: hidden;
  }
  .another::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-20deg);
    animation: shine 3.2s ease-in-out infinite;
  }
  @keyframes shine { 0%, 55% { left: -40%; } 100% { left: 130%; } }
  .another .die { font-size: 1.25em; display: inline-block; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
  .another:hover { transform: translateY(-3px) scale(1.01); background-position: 100% 0; box-shadow: 0 24px 60px -16px var(--c1), inset 0 1px 0 rgba(255, 255, 255, .45); }
  .another:hover .die { transform: rotate(200deg) scale(1.15); }
  .another:active { transform: scale(.97); }
  .kbd { margin-top: 12px; text-align: center; font-size: 12px; color: var(--muted); }
  .kbd kbd { font: 600 11px var(--body); border: 1px solid var(--glass-line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; margin: 0 2px; }


  /* доступность: уважаем «меньше движения» — фон замирает, реакции на события остаются статичными */
  @media (prefers-reduced-motion: reduce) {
    .blob, .tile, .another::after, .hint .big, .gavel-mark, .gavel-mark::after,
    .result > *, .result .text > *, .result .emoji, .sold-stamp,
    .hero::before, .bar::after, .player.playing .eq i { animation: none !important; }
    .gavel-mark::after { display: none; }
  }
