  :root {
    --bg: #05060d;
    --bg-2: #0a0d1a;
    --panel: #0e1426;
    --panel-2: #131b33;
    --ink: #e8ecf5;
    --ink-dim: #8993ad;
    --line: #1f2a48;
    --cyan: #00e5ff;
    --magenta: #ff2e9a;
    --yellow: #ffd400;
    --green: #5cffb1;
    --red: #ff3d4e;
    --p1: #00e5ff;
    --p2: #ff2e9a;
    --shadow-cyan: 0 0 24px rgba(0, 229, 255, 0.45);
    --shadow-mag: 0 0 24px rgba(255, 46, 154, 0.45);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  html, body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
  }

  body {
    background:
      radial-gradient(ellipse at 20% 0%, rgba(0,229,255,0.08), transparent 50%),
      radial-gradient(ellipse at 80% 100%, rgba(255,46,154,0.08), transparent 50%),
      linear-gradient(180deg, #05060d 0%, #0a0d1a 100%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
  }

  body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
      linear-gradient(rgba(0,229,255,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,229,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  }

  .app {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
  }

  /* ===== HEADER ===== */
  header.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
  }
  @media (max-width: 720px) {
    header.brand {
      justify-content: center;
      gap: 16px;
    }
    .logo {
      width: 100%;
      justify-content: center;
    }
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .logo-mark {
    width: 44px; height: 44px;
    border: 2px solid var(--cyan);
    border-radius: 50%;
    position: relative;
    box-shadow: var(--shadow-cyan), inset 0 0 12px rgba(0,229,255,0.3);
  }
  .logo-mark::before, .logo-mark::after {
    content: '';
    position: absolute;
    background: var(--cyan);
  }
  .logo-mark::before {
    inset: 4px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--cyan);
  }
  .logo-mark::after {
    width: 6px; height: 6px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyan);
  }

  h1.title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(20px, 5vw, 30px);
    letter-spacing: 0.18em;
    line-height: 1;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 30px rgba(0,229,255,0.25);
  }

  .subtitle {
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--ink-dim);
    margin-top: 4px;
    text-transform: uppercase;
  }

  .status-chip {
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--ink-dim);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .status-chip .dot {
    width: 8px; height: 8px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--green);
    animation: pulse 1.6s ease-in-out infinite;
  }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

  .header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
  }
  @media (max-width: 720px) {
    .header-right {
      align-items: center;
      width: 100%;
    }
  }
  .header-link {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--cyan);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--cyan);
    background: rgba(0,229,255,0.06);
    box-shadow: 0 0 12px rgba(0,229,255,0.25);
    text-shadow: 0 0 6px rgba(0,229,255,0.6);
    transition: all 0.2s;
    white-space: nowrap;
  }
  .header-link:hover {
    background: rgba(0,229,255,0.15);
    box-shadow: 0 0 20px rgba(0,229,255,0.5);
  }
  .header-link::before {
    content: '> ';
    opacity: 0.6;
  }

  /* ===== SCREEN MANAGEMENT ===== */
  .screen { display: none; }
  .screen.active { display: block; animation: fadeIn 0.4s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  /* ===== SETUP SCREEN ===== */
  .setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: stretch;
  }
  @media (max-width: 720px) {
    .setup-grid { grid-template-columns: 1fr; }
  }

  .vs-divider {
    display: none;
  }

  .fighter-card {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 22px;
    position: relative;
    overflow: hidden;
  }
  .fighter-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent, var(--cyan));
    box-shadow: 0 0 12px var(--accent, var(--cyan));
  }
  .fighter-card[data-player="1"] { --accent: var(--p1); }
  .fighter-card[data-player="2"] { --accent: var(--p2); }

  .card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .player-tag {
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--accent);
  }
  .player-code {
    font-size: 10px;
    color: var(--ink-dim);
    letter-spacing: 0.2em;
  }

  /* ===== ANALYSIS ANIMATION ===== */
  .image-slot.analyzing img.preview {
    filter: brightness(0.55) saturate(1.4);
  }

  .scan-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    overflow: hidden;
  }
  .image-slot.analyzing .scan-overlay { opacity: 1; }

  .scan-line {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent, var(--cyan)), transparent);
    box-shadow: 0 0 16px var(--accent, var(--cyan)), 0 0 32px var(--accent, var(--cyan));
    animation: scan-move 1.0s linear infinite;
  }
  @keyframes scan-move {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
  }

  .scan-grid {
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(0,229,255,0.18) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,229,255,0.18) 1px, transparent 1px);
    background-size: 16px 16px;
    animation: scan-flicker 0.5s ease infinite alternate;
  }
  @keyframes scan-flicker {
    from { opacity: 0.3; }
    to { opacity: 0.8; }
  }

  .scan-corners {
    position: absolute;
    inset: 8px;
    pointer-events: none;
  }
  .scan-corners::before, .scan-corners::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border: 2px solid var(--accent, var(--cyan));
    box-shadow: 0 0 8px var(--accent, var(--cyan));
  }
  .scan-corners::before {
    top: 0; left: 0;
    border-right: 0; border-bottom: 0;
  }
  .scan-corners::after {
    bottom: 0; right: 0;
    border-left: 0; border-top: 0;
  }

  .scan-text {
    position: absolute;
    bottom: 12px; left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.35em;
    color: var(--accent, var(--cyan));
    text-shadow: 0 0 8px var(--accent, var(--cyan));
    background: rgba(5,6,13,0.75);
    padding: 5px 12px;
    border: 1px solid var(--accent, var(--cyan));
    white-space: nowrap;
  }

  /* ===== TYPE REVEAL ANIMATION ===== */
  .archetype.revealing {
    color: var(--accent);
    animation: type-flicker 0.06s steps(2) infinite;
  }
  @keyframes type-flicker {
    0% { opacity: 0.7; transform: skewX(0deg); }
    50% { opacity: 1; transform: skewX(0.4deg); }
  }
  .archetype.locked {
    animation: type-lock 0.7s cubic-bezier(.2,.9,.3,1.1);
  }
  @keyframes type-lock {
    0% {
      transform: scale(1.6);
      letter-spacing: 0.6em;
      opacity: 0;
      filter: blur(8px);
    }
    40% {
      transform: scale(1.15);
      letter-spacing: 0.35em;
      opacity: 1;
      filter: blur(0);
    }
    100% {
      transform: scale(1);
      letter-spacing: 0.25em;
      opacity: 1;
    }
  }

  /* ===== STAT VALUE POP ===== */
  .stat-row.locked .stat-value {
    animation: value-pop 0.45s cubic-bezier(.2,.9,.3,1.1);
  }
  @keyframes value-pop {
    0% { transform: scale(1.5); text-shadow: 0 0 14px var(--accent); filter: brightness(1.5); }
    100% { transform: scale(1); text-shadow: 0 0 0 var(--accent); filter: brightness(1); }
  }

  /* ===== CARD COMPLETION FLASH ===== */
  @keyframes card-complete-flash {
    0% { box-shadow: 0 0 0 var(--accent); }
    30% { box-shadow: 0 0 60px var(--accent), inset 0 0 40px color-mix(in srgb, var(--accent) 25%, transparent); }
    100% { box-shadow: 0 0 0 var(--accent); }
  }
  .fighter-card.complete {
    animation: card-complete-flash 0.9s ease-out;
  }

  .image-slot {
    aspect-ratio: 1 / 1;
    width: 100%;
    background:
      repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 12px, transparent 12px 24px),
      var(--bg);
    border: 1.5px dashed var(--line);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
  }
  .image-slot:hover { border-color: var(--accent); background: rgba(255,255,255,0.02); }
  .image-slot.dragover { border-color: var(--accent); background: rgba(0,229,255,0.05); border-style: solid; }
  .image-slot img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .image-slot canvas { display: none; }

  .image-slot img.preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .slot-placeholder {
    text-align: center;
    color: var(--ink-dim);
    pointer-events: none;
    padding: 20px;
  }
  .slot-placeholder .ico {
    font-size: 36px;
    margin-bottom: 8px;
    color: var(--accent);
    opacity: 0.6;
  }
  .slot-placeholder .label {
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
  }
  .slot-placeholder .hint {
    font-size: 10px;
    margin-top: 4px;
    color: var(--ink-dim);
    opacity: 0.7;
  }

  .stats-block {
    margin-top: 18px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .stats-block.empty {
    align-items: center;
    color: var(--ink-dim);
    font-size: 10px;
    letter-spacing: 0.2em;
    opacity: 0.4;
  }

  .stat-row {
    display: grid;
    grid-template-columns: 60px 1fr 40px;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 11px;
    letter-spacing: 0.15em;
  }
  .stat-row .stat-label { color: var(--ink-dim); }
  .stat-row .stat-value {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-align: right;
    color: var(--accent);
  }
  .stat-bar {
    height: 6px;
    background: var(--bg);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
  }
  .stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, white));
    box-shadow: 0 0 8px var(--accent);
    width: 0%;
    /* グーンと伸びる: 軽いオーバーシュート気味のイージング */
    transition: width 1.0s cubic-bezier(.15,.85,.25,1.1);
  }

  .archetype {
    margin-top: 14px;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.25em;
    color: var(--accent);
    text-transform: uppercase;
    padding: 8px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .archetype.empty { color: var(--ink-dim); opacity: 0.3; }

  /* ===== BATTLE BUTTON ===== */
  .battle-launcher {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .rights-notice {
    font-size: 11px;
    color: var(--ink-dim);
    letter-spacing: 0.04em;
    text-align: center;
    max-width: 600px;
    line-height: 1.5;
  }
  .rights-notice a {
    color: var(--cyan);
    text-decoration: none;
    margin-left: 2px;
  }
  .rights-notice a:hover {
    text-decoration: underline;
  }
  .btn-fight {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.4em;
    padding: 18px 48px;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    color: var(--bg);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    text-transform: uppercase;
    position: relative;
    transition: transform 0.15s, filter 0.15s;
    box-shadow: 0 0 24px rgba(0,229,255,0.5), 0 0 24px rgba(255,46,154,0.4);
  }
  .btn-fight:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.15); }
  .btn-fight:active:not(:disabled) { transform: translateY(0); }
  .btn-fight:disabled {
    background: var(--panel-2);
    color: var(--ink-dim);
    cursor: not-allowed;
    box-shadow: none;
  }

  /* ===== BATTLE SCREEN ===== */
  .battle-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .battle-side {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
  }
  .battle-side[data-player="1"] { --accent: var(--p1); }
  .battle-side[data-player="2"] { --accent: var(--p2); justify-content: flex-end; flex-direction: row-reverse; }
  .battle-side[data-player="2"] { border-left: 1px solid var(--line); border-right: 3px solid var(--accent); }
  .battle-side .thumb {
    width: 42px; height: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent);
    box-shadow: 0 0 10px var(--accent);
    flex-shrink: 0;
  }
  .battle-side .thumb img { width: 100%; height: 100%; object-fit: cover; }
  .battle-side .info {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--ink-dim);
    flex: 1;
    min-width: 0;
  }
  .battle-side .info .name {
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.2em;
  }
  .battle-side[data-player="2"] .info { text-align: right; }

  .hp-bar {
    margin-top: 4px;
    height: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
  }
  .hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
    box-shadow: 0 0 6px var(--accent);
    width: 100%;
    transition: width 0.15s linear;
  }
  .hp-bar-fill.low {
    background: linear-gradient(90deg, var(--red), #ff8800);
    box-shadow: 0 0 8px var(--red);
    animation: hp-pulse 0.5s ease-in-out infinite alternate;
  }
  @keyframes hp-pulse { from { opacity: 0.7; } to { opacity: 1; } }
  .battle-side[data-player="2"] .hp-bar-fill {
    float: right;
  }
  .battle-side[data-player="2"] .hp-bar {
    direction: rtl;
  }

  .vs-tag {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 22px;
    color: var(--ink);
    letter-spacing: 0.1em;
    text-shadow: 0 0 16px var(--ink);
  }

  @media (max-width: 600px) {
    .battle-header { grid-template-columns: 1fr auto 1fr; gap: 6px; }
    .battle-side { padding: 6px 8px; gap: 8px; }
    .battle-side .thumb { width: 32px; height: 32px; }
    .battle-side .info .name { font-size: 10px; }
    .battle-side .info .stat-mini { font-size: 8px; }
    .vs-tag { font-size: 14px; }
  }

  .arena-frame {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 12px;
    overflow: hidden;
    max-width: 720px;
    margin: 0 auto;
  }
  .arena-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
      linear-gradient(135deg, transparent 0%, transparent 80%, rgba(0,229,255,0.06) 100%),
      linear-gradient(-135deg, transparent 0%, transparent 80%, rgba(255,46,154,0.06) 100%);
    pointer-events: none;
  }

  #arena {
    display: block;
    width: 100%;
    height: auto;
    background: radial-gradient(ellipse at center, #0d1426 0%, #05060d 70%);
    border-radius: 2px;
    touch-action: none;
  }

  .battle-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--ink-dim);
    text-transform: uppercase;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  .timer {
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: var(--yellow);
    text-shadow: 0 0 10px rgba(255,212,0,0.4);
    transition: color 0.3s, text-shadow 0.3s;
  }
  .timer.urgent {
    color: var(--red);
    text-shadow: 0 0 14px var(--red);
    animation: timer-pulse 0.5s ease-in-out infinite alternate;
  }
  @keyframes timer-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
  }

  /* ===== バトル中の中央文字オーバーレイ ===== */
  .battle-banner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
  }
  .battle-banner.show {
    animation: banner-burst 1.4s cubic-bezier(.2,.9,.3,1.1) both;
  }
  .battle-banner.show.long {
    animation-duration: 2.2s;
  }
  @keyframes banner-burst {
    0% {
      opacity: 0;
      transform: translate(-50%, -50%) scale(2.5);
      filter: blur(12px);
      letter-spacing: 0.8em;
    }
    20% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.0);
      filter: blur(0);
      letter-spacing: 0.15em;
    }
    75% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.05);
      filter: blur(0);
      letter-spacing: 0.2em;
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -50%) scale(1.3);
      filter: blur(8px);
      letter-spacing: 0.4em;
    }
  }

  .battle-banner .label {
    display: block;
    font-size: clamp(36px, 11vw, 88px);
    line-height: 1;
    letter-spacing: 0.12em;
    white-space: nowrap;
  }
  .battle-banner .label.small {
    font-size: clamp(28px, 6.5vw, 56px);
    letter-spacing: 0.10em;
  }
  .battle-banner .sub {
    display: block;
    font-size: clamp(10px, 2.5vw, 16px);
    margin-top: 12px;
    letter-spacing: 0.35em;
    opacity: 0.7;
    font-weight: 600;
    white-space: nowrap;
  }

  /* テーマ別カラー */
  .battle-banner.ready {
    color: var(--cyan);
    text-shadow: 0 0 30px var(--cyan), 0 0 60px rgba(0,229,255,0.4);
  }
  .battle-banner.fight {
    background: linear-gradient(180deg, #ffd400 0%, #ff8800 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 24px rgba(255,212,0,0.7)) drop-shadow(0 0 48px rgba(255,136,0,0.5));
  }
  .battle-banner.destroyed {
    background: linear-gradient(180deg, #ff3d4e 0%, #ff8800 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 24px rgba(255,61,78,0.8)) drop-shadow(0 0 48px rgba(255,136,0,0.6));
  }
  .battle-banner.ringout {
    background: linear-gradient(180deg, #00e5ff 0%, #ff2e9a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 24px rgba(0,229,255,0.7)) drop-shadow(0 0 48px rgba(255,46,154,0.5));
  }
  .battle-banner.timeup {
    color: var(--yellow);
    text-shadow: 0 0 30px var(--yellow), 0 0 60px rgba(255,212,0,0.5);
  }

  /* カウントダウン数字 */
  .countdown-num {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 22vw;
    color: var(--cyan);
    text-shadow: 0 0 40px var(--cyan), 0 0 80px rgba(0,229,255,0.5);
    opacity: 0;
    line-height: 1;
  }
  .countdown-num.show {
    animation: countdown-pop 1.0s cubic-bezier(.2,.9,.3,1.1) both;
  }
  @keyframes countdown-pop {
    0% {
      opacity: 0;
      transform: translate(-50%, -50%) scale(3);
      filter: blur(16px);
    }
    25% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
      filter: blur(0);
    }
    80% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -50%) scale(1.3);
      filter: blur(6px);
    }
  }
  @media (min-width: 768px) {
    .countdown-num { font-size: 160px; }
  }

  /* ===== RESULT MODAL ===== */
  .result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,6,13,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
  }
  .result-overlay.show { display: flex; animation: fadeIn 0.4s ease; }

  .result-card {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--accent, var(--cyan));
    border-radius: 4px;
    padding: 36px 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 0 60px var(--accent, var(--cyan));
  }
  .result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent, var(--cyan));
    box-shadow: 0 0 16px var(--accent, var(--cyan));
  }

  .result-label {
    font-size: 11px;
    letter-spacing: 0.4em;
    color: var(--ink-dim);
    text-transform: uppercase;
    margin-bottom: 12px;
  }
  .result-winner {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 32px;
    color: var(--accent, var(--cyan));
    letter-spacing: 0.2em;
    text-shadow: 0 0 20px var(--accent, var(--cyan));
    margin-bottom: 22px;
  }
  .result-winner.draw {
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
  }
  .result-thumb {
    width: 110px; height: 110px;
    margin: 0 auto 22px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent, var(--cyan));
    box-shadow: 0 0 30px var(--accent, var(--cyan));
  }
  .result-thumb img { width: 100%; height: 100%; object-fit: cover; }

  /* ドロー時の2枚並び */
  .result-thumb-pair {
    display: none;
    justify-content: center;
    gap: 20px;
    margin: 0 auto 22px;
  }
  .result-thumb-pair .pair-item {
    width: 90px; height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid;
  }
  .result-thumb-pair .pair-item.p1 {
    border-color: #00e5ff;
    box-shadow: 0 0 24px #00e5ff;
  }
  .result-thumb-pair .pair-item.p2 {
    border-color: #ff2e9a;
    box-shadow: 0 0 24px #ff2e9a;
  }
  .result-thumb-pair .pair-item img { width: 100%; height: 100%; object-fit: cover; }
  .result-card.draw-mutual .result-thumb { display: none; }
  .result-card.draw-mutual .result-thumb-pair { display: flex; }

  .result-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
  }
  .btn {
    flex: 1;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.25em;
    padding: 14px 16px;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink-dim);
    border-radius: 2px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
  }
  .btn:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: var(--shadow-cyan); }
  .btn.primary {
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    color: var(--bg);
    border: none;
  }
  .btn.primary:hover { filter: brightness(1.15); }

  /* ===== FOOTER ===== */
  footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--ink-dim);
    text-transform: uppercase;
  }
  footer .copyright {
    margin-bottom: 12px;
  }
  footer .footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: none;
  }
  footer .footer-links a {
    color: var(--ink-dim);
    text-decoration: none;
    transition: color 0.2s;
  }
  footer .footer-links a:hover {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0,229,255,0.5);
  }
  footer .footer-sep {
    color: var(--line);
    opacity: 0.6;
  }

  /* ===== SCREEN SHAKE ===== */
  @keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-3px, 1px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-1px, 2px); }
  }
  .arena-frame.shake { animation: shake 0.18s; }
