    @import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;800&family=Inter:wght@400;500;600;700;800&display=swap");

    :root {
      --navy-950: #050d19;
      --navy-900: #071426;
      --navy-850: #0a1b31;
      --navy-800: #0e2744;
      --line: rgba(180, 208, 236, .14);
      --white: #f7fbff;
      --muted: #91a5ba;
      --yellow: #ffd438;
      --red: #ef4444;
      --green: #42dda0;
      --shadow: 0 24px 70px rgba(0, 0, 0, .32);
    }

    * { box-sizing: border-box; }
    html { min-height: 100%; }

    body {
      min-height: 100vh;
      margin: 0;
      overflow-x: hidden;
      color: var(--white);
      background:
        radial-gradient(circle at 46% -18%, rgba(46, 92, 143, .18), transparent 44%),
        linear-gradient(145deg, #030914 0%, #071528 48%, #050d19 100%);
      background-color: var(--navy-950);
      background-repeat: no-repeat;
      isolation: isolate;
      font-family: Inter, system-ui, sans-serif;
    }

    body::before {
      content: "";
      position: fixed;
      inset: -18%;
      z-index: 0;
      opacity: .72;
      pointer-events: none;
      background:
        radial-gradient(circle at 19% 24%, rgba(37, 99, 235, .24), transparent 19%),
        radial-gradient(circle at 77% 19%, rgba(14, 165, 233, .15), transparent 17%),
        radial-gradient(circle at 69% 76%, rgba(124, 58, 237, .12), transparent 20%),
        radial-gradient(circle at 23% 82%, rgba(255, 212, 56, .075), transparent 16%);
      filter: blur(34px);
      transform: translate3d(0, 0, 0) scale(1.03);
      animation: ambientDrift 26s ease-in-out infinite alternate;
      will-change: transform;
    }

    body::after {
      content: "";
      position: fixed;
      z-index: 0;
      inset: 0;
      opacity: .42;
      pointer-events: none;
      background:
        radial-gradient(ellipse 28% 20% at 8% 58%, rgba(125, 211, 252, .08), transparent 72%),
        radial-gradient(ellipse 26% 22% at 92% 42%, rgba(196, 181, 253, .07), transparent 72%);
      filter: blur(22px);
      animation: ambientDrift 32s -9s ease-in-out infinite alternate-reverse;
    }

    button, input { font: inherit; }
    button { -webkit-tap-highlight-color: transparent; }

    .app {
      position: relative;
      z-index: 1;
      width: min(1280px, calc(100% - 28px));
      margin: 0 auto;
      padding: 30px 0 42px;
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 20px;
      margin-bottom: 22px;
    }

    .brand { display: flex; align-items: center; gap: 13px; }
    .brand-copy { display: grid; gap: 4px; }
    .brand-tagline {
      margin: 0;
      color: #91a5ba;
      font-size: .68rem;
      font-weight: 750;
      letter-spacing: .13em;
      text-transform: uppercase;
    }
    .brand-ball {
      width: 49px;
      height: 49px;
      display: grid;
      place-items: center;
      border-radius: 15px;
      color: #111827;
      background: var(--yellow);
      box-shadow: 0 10px 28px rgba(255,212,56,.14);
      font-size: 1.55rem;
      transform: rotate(-4deg);
    }

    h1 {
      margin: 0;
      font: 800 clamp(1.6rem, 4vw, 2.05rem)/.95 "Barlow Condensed", sans-serif;
      letter-spacing: .02em;
      text-transform: uppercase;
    }

    .actions { display: flex; align-items: center; gap: 9px; }
    .identity-chip {
      min-height: 45px;
      display: flex;
      align-items: center;
      gap: 9px;
      border: 1px solid rgba(185,216,242,.17);
      border-radius: 13px;
      padding: 5px 10px 5px 6px;
      color: #eef6fc;
      background: rgba(255,255,255,.035);
      text-align: left;
    }
    .identity-chip.signed-in { cursor: pointer; }
    .identity-chip.signed-in:hover { border-color: rgba(255,212,56,.35); background: rgba(255,212,56,.05); }
    .auth-entry {
      min-height: 45px;
      border: 1px solid rgba(255,212,56,.3);
      border-radius: 13px;
      padding: 0 13px;
      color: var(--yellow);
      background: rgba(255,212,56,.07);
      font: 800 .67rem/1.1 Inter, sans-serif;
      cursor: pointer;
      white-space: nowrap;
      transition: border-color .18s ease, color .18s ease, background .18s ease;
    }
    .auth-entry:hover { border-color: rgba(255,212,56,.58); color: white; background: rgba(255,212,56,.14); }
    .auth-entry[hidden] { display: none; }
    .account-avatar {
      width: 33px;
      height: 33px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border-radius: 10px;
      color: #111827;
      background: var(--yellow);
      font: 800 .85rem/1 "Barlow Condensed", sans-serif;
    }
    .account-copy { display: grid; gap: 2px; min-width: 0; }
    .account-copy strong { max-width: 100px; overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
    .account-copy span { color: var(--muted); font-size: .58rem; font-weight: 700; }
    .header-logout {
      width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border: 1px solid rgba(239,68,68,.25);
      border-radius: 10px;
      color: #fecaca;
      background: rgba(239,68,68,.07);
      font-size: 1rem;
      cursor: pointer;
      transition: border-color .18s ease, color .18s ease, background .18s ease;
    }
    .header-logout:hover { border-color: rgba(239,68,68,.55); color: white; background: rgba(239,68,68,.16); }
    .header-logout[hidden] { display: none; }
    .mode-switch {
      display: inline-flex;
      align-items: stretch;
      gap: 3px;
      padding: 4px;
      border: 1px solid var(--line);
      border-radius: 13px;
      background: rgba(255,255,255,.025);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
    }
    .mode-option {
      min-width: 0;
      min-height: 44px;
      border: 0;
      border-radius: 9px;
      padding: 0 9px;
      color: var(--muted);
      background: transparent;
      font-size: .76rem;
      font-weight: 800;
      line-height: 1.15;
      cursor: pointer;
      transition: color .18s ease, background .18s ease, box-shadow .18s ease;
    }
    .mode-option:hover { color: white; background: rgba(255,255,255,.045); }
    .mode-option[aria-pressed="true"] {
      color: #111827;
      background: var(--yellow);
      box-shadow: 0 5px 16px rgba(255,212,56,.13);
    }
    .mode-option:focus-visible { outline: 2px solid white; outline-offset: 2px; }
    .btn {
      min-height: 45px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 0 16px;
      color: #d7e4f0;
      background: rgba(255,255,255,.035);
      font-weight: 750;
      cursor: pointer;
      transition: transform .18s ease, border-color .18s ease, background .18s ease;
    }
    .btn:hover { transform: translateY(-2px); border-color: rgba(255,212,56,.35); }
    .btn.primary { border: 0; color: #121827; background: var(--yellow); }
    .btn.primary:hover { background: #ffe06b; }
    .btn.danger { border-color: rgba(239,68,68,.42); color: #fecaca; background: rgba(239,68,68,.1); }
    .btn.danger:hover { border-color: rgba(239,68,68,.72); color: white; background: rgba(239,68,68,.2); }
    .btn:disabled { opacity: .58; cursor: wait; transform: none; }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 210px;
      gap: 16px;
      align-items: start;
    }

    .play-lobby { margin-bottom: 20px; padding: 16px; }
    .play-lobby-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
    .play-lobby-head h2 { margin: 0; font: 800 1.22rem/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
    .play-lobby-head p { margin: 5px 0 0; color: var(--muted); font-size: .74rem; }
    .session-summary {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border: 1px solid rgba(255,255,255,.1);
      border-radius: 10px;
      padding: 7px 10px;
      color: #dce8f3;
      background: rgba(255,255,255,.025);
      font-size: .63rem;
      font-weight: 800;
      white-space: nowrap;
    }
    .session-summary::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
    .play-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
    .play-card {
      min-width: 0;
      min-height: 78px;
      display: grid;
      grid-template-columns: 34px 1fr;
      align-items: center;
      gap: 10px;
      border: 1px solid rgba(185,216,242,.13);
      border-radius: 14px;
      padding: 11px;
      color: #eaf3fb;
      background: rgba(255,255,255,.025);
      cursor: pointer;
      text-align: left;
      transition: border-color .18s ease, background .18s ease, transform .18s ease;
    }
    .play-card:hover { transform: translateY(-2px); border-color: rgba(255,212,56,.34); background: rgba(255,212,56,.045); }
    .play-card.active { border-color: rgba(255,212,56,.44); background: rgba(255,212,56,.075); box-shadow: inset 0 -2px 0 var(--yellow); }
    .play-card.ranked { border-color: rgba(239,68,68,.24); }
    .play-card.ranked:hover { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.06); }
    .play-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--yellow); background: rgba(255,212,56,.08); font-size: 1rem; }
    .ranked .play-icon { color: #ff7474; background: rgba(239,68,68,.1); }
    .play-copy { min-width: 0; display: grid; gap: 4px; }
    .play-copy strong { font-size: .77rem; line-height: 1.15; }
    .play-copy span { overflow: hidden; color: var(--muted); font-size: .65rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

    .round-tools { display: flex; align-items: center; gap: 8px; }
    .timer-pill {
      min-width: 46px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(255,212,56,.2);
      border-radius: 9px;
      padding: 6px 8px;
      color: var(--yellow);
      background: rgba(255,212,56,.06);
      font: 800 .78rem/1 "Barlow Condensed", sans-serif;
      letter-spacing: .02em;
    }
    .timer-pill.danger { color: #ff6b72; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }

    .card {
      position: relative;
      border: 1px solid rgba(185, 216, 242, .16);
      border-radius: 21px;
      background:
        linear-gradient(135deg, rgba(255,255,255,.055), transparent 38%),
        rgba(7, 24, 43, .82);
      box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.035);
      backdrop-filter: blur(15px) saturate(125%);
    }

    .game-card { min-width: 0; padding: 18px; }
    .board-meta {
      min-height: 35px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      margin: 0 3px 13px;
      color: var(--muted);
      font-size: .69rem;
      font-weight: 800;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    .board-scroll { overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
    .board {
      position: relative;
      isolation: isolate;
      min-width: 640px;
      display: grid;
      grid-template-columns: 104px repeat(3, minmax(0,1fr));
      grid-template-rows: 91px repeat(3, 145px);
      gap: 7px;
    }

    .corner, .team, .square {
      border: 1px solid rgba(255,255,255,.1);
      border-radius: 16px;
    }
    .corner {
      display: grid;
      place-items: center;
      color: #47617b;
      border-style: dashed;
      font-size: 1.35rem;
      background: rgba(255,255,255,.015);
    }

    .team {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-width: 0;
      padding: 8px;
      background: rgba(255,255,255,.035);
    }
    .team.row { flex-direction: column; gap: 6px; text-align: center; }
    .badge {
      width: 39px;
      height: 39px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border: 2px solid hsl(var(--hue) 78% 67%);
      border-radius: 50%;
      color: white;
      background: hsl(var(--hue) 58% 35%);
      box-shadow: inset 0 0 0 3px rgba(255,255,255,.055), 0 5px 14px rgba(0,0,0,.2);
      font: 800 .75rem/1 "Barlow Condensed", sans-serif;
    }
    .badge.has-logo {
      padding: 2px;
      overflow: visible;
      border: 1px solid rgba(255,255,255,.2);
      border-radius: 11px;
      background: rgba(247,251,255,.96);
      box-shadow: 0 5px 14px rgba(0,0,0,.24);
    }
    .badge-logo {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: contain;
      transform: translateY(-5px);
    }
    .badge.has-logo.logo-amed {
      overflow: hidden;
    }
    .badge.has-logo.logo-amed .badge-logo {
      transform: scale(1.75);
    }
    .badge.has-logo.logo-corum .badge-logo {
      border-radius: 8px;
      transform: translateY(-2px);
    }
    .team-name {
      min-width: 0;
      overflow: hidden;
      color: #eaf3fb;
      font-size: .72rem;
      font-weight: 750;
      line-height: 1.2;
      text-overflow: ellipsis;
    }

    .square {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      overflow: hidden;
      color: white;
      background: rgba(8, 27, 48, .78);
      cursor: pointer;
      transition: transform .18s ease, border-color .18s ease, background .18s ease;
    }
    .square::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 1;
      opacity: 0;
      pointer-events: none;
      background: rgba(239, 68, 68, .12);
    }
    .square::after {
      content: "";
      position: absolute;
      inset: 11px;
      border: 1px solid rgba(255,255,255,.026);
      border-radius: 10px;
      pointer-events: none;
    }
    .square:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(255,212,56,.43); background-color: #0c2743; }
    .square:disabled { cursor: default; opacity: 1; }
    .plus { color: #4a647d; font-size: 1.4rem; }
    .answer { position: relative; z-index: 3; width: calc(100% - 18px); overflow: hidden; color: #dce8f3; font-size: .7rem; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
    .square.x { --move-color: #ef4444; border-color: rgba(239,68,68,.28); background: rgba(239,68,68,.035); }
    .square.o { --move-color: #f8fafc; border-color: rgba(248,250,252,.22); background: rgba(248,250,252,.026); }
    .square.win { border-color: color-mix(in srgb, var(--move-color) 56%, transparent); background: color-mix(in srgb, var(--move-color) 5%, #081b30); }

    .move-symbol {
      position: relative;
      z-index: 2;
      width: 64px;
      height: 64px;
      flex: 0 0 auto;
      pointer-events: none;
    }
    .symbol-cleats { width: 66px; height: 66px; overflow: hidden; }
    .symbol-cleats img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
      object-fit: contain;
    }
    .symbol-o-image { width: 66px; height: 66px; overflow: hidden; }
    .symbol-o-image img {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 303%;
      height: auto;
      max-width: none;
      display: block;
      transform: translate(-50%, -50%);
    }
    .square.just-played .move-symbol { animation: symbolSettle .38s cubic-bezier(.2,.72,.28,1) both; }

    .square.wrong-flash::before { animation: invalidWash .72s ease-out; }
    .invalid-burst {
      position: absolute;
      inset: 0;
      z-index: 4;
      display: grid;
      place-content: center;
      color: #fee2e2;
      pointer-events: none;
      animation: invalidLabel .72s ease-out both;
    }
    .invalid-burst b { padding: 6px 10px; border: 1px solid rgba(239,68,68,.42); border-radius: 7px; background: rgba(94,22,22,.78); font-size: .65rem; letter-spacing: .12em; }

    .win-line {
      position: absolute;
      inset: 0;
      z-index: 10;
      width: 100%;
      height: 100%;
      overflow: visible;
      pointer-events: none;
    }
    .win-line.x { --win-line-color: #ef4444; }
    .win-line.o { --win-line-color: #f8fafc; }
    .win-line line {
      fill: none;
      stroke: var(--win-line-color);
      stroke-width: 5;
      stroke-linecap: round;
      stroke-dasharray: 1;
      stroke-dashoffset: 1;
      animation: drawWinLine .72s .08s cubic-bezier(.22,.72,.25,1) forwards;
    }

    @keyframes ambientDrift { to { transform: translate3d(2.5%, -1.5%, 0) scale(1.08); } }
    @keyframes symbolSettle { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }
    @keyframes invalidWash { 0%,100% { opacity: 0; } 30%,62% { opacity: 1; } }
    @keyframes invalidLabel { from { opacity: 0; transform: translateY(4px); } 28%,66% { opacity: 1; transform: translateY(0); } to { opacity: 0; } }
    @keyframes drawWinLine { to { stroke-dashoffset: 0; } }

    .side { display: grid; gap: 15px; }
    .side .card { padding: 20px; }
    .side-label { margin: 0 0 13px; color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
    .turn { display: flex; align-items: center; gap: 13px; }
    .turn-mark {
      width: 53px;
      height: 53px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border: 1px solid color-mix(in srgb, var(--turn-color) 40%, transparent);
      border-radius: 14px;
      color: var(--turn-color);
      background: color-mix(in srgb, var(--turn-color) 8%, transparent);
      font: 800 2.5rem/1 "Barlow Condensed", sans-serif;
    }
    .turn-mark .move-symbol { width: 38px; height: 38px; }
    .turn strong { display: block; font-size: .97rem; }
    .turn span { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; line-height: 1.4; }

    .score {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 12px;
      margin-top: 18px;
      padding-top: 17px;
      border-top: 1px solid var(--line);
    }
    .score-player { display: flex; align-items: center; gap: 8px; }
    .score-player:last-child { justify-content: flex-end; }
    .score-player b { font-size: 1.15rem; }
    .mini-mark { width: 25px; height: 25px; display: grid; place-items: center; }
    .mini-mark .move-symbol { width: 23px; height: 23px; }
    .dash { color: #526981; }

    .help { margin: 0; padding: 0; list-style: none; display: grid; gap: 13px; }
    .help li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
    .num { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--yellow); background: rgba(255,212,56,.08); font: 800 .8rem/1 "Barlow Condensed", sans-serif; }
    .help p { margin: 1px 0 0; color: #b6c6d6; font-size: .73rem; line-height: 1.5; }
    dialog {
      width: min(455px, calc(100% - 26px));
      padding: 0;
      border: 1px solid rgba(185,211,237,.17);
      border-radius: 21px;
      color: white;
      background: #0a1b30;
      box-shadow: 0 28px 85px rgba(0,0,0,.6);
    }
    dialog::backdrop { background: rgba(2,8,16,.77); backdrop-filter: blur(7px); }
    .modal { padding: 25px; }
    .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
    .modal-kicker { color: var(--yellow); font-size: .63rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
    .modal h2 { margin: 5px 0 0; font: 800 1.7rem/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
    .close { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 9px; color: #bdcddd; background: rgba(255,255,255,.035); cursor: pointer; }
    .matchup { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 22px 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
    .match-team { display: grid; justify-items: center; gap: 7px; min-width: 0; text-align: center; }
    .versus { color: #5d748b; font: 800 .8rem/1 "Barlow Condensed", sans-serif; }
    label { display: block; margin-bottom: 8px; color: #deebf6; font-size: .76rem; font-weight: 700; }
    .input-shell { position: relative; }
    .input { width: 100%; height: 51px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; outline: 0; padding: 0 14px; color: white; background: #061426; }
    .input:focus { border-color: rgba(255,212,56,.55); box-shadow: 0 0 0 4px rgba(255,212,56,.07); }
    .suggestions {
      display: grid;
      max-height: 255px;
      overflow-y: auto;
      margin-top: 7px;
      border: 1px solid rgba(180,208,236,.2);
      border-radius: 13px;
      background: #08192c;
      box-shadow: 0 18px 45px rgba(0,0,0,.48);
    }
    .suggestions[hidden] { display: none; }
    .suggestion {
      min-width: 0;
      display: block;
      border: 0;
      border-bottom: 1px solid rgba(180,208,236,.1);
      padding: 10px 12px;
      color: #eaf3fb;
      background: transparent;
      text-align: left;
      cursor: pointer;
    }
    .suggestion:last-child { border-bottom: 0; }
    .suggestion:hover, .suggestion.active { color: white; background: rgba(255,212,56,.11); }
    .suggestion.active { box-shadow: inset 3px 0 0 var(--yellow); }
    .suggestion-name { min-width: 0; overflow: hidden; font-size: .78rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
    .error-text { min-height: 18px; margin: 7px 2px 0; color: #ff828c; font-size: .69rem; }
    .modal-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 9px; margin-top: 11px; }

    .result-dialog {
      --result-color: #f8fafc;
      position: fixed;
      inset: 0;
      width: 100vw;
      max-width: none;
      height: 100dvh;
      max-height: none;
      margin: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
      backdrop-filter: none;
      overflow: hidden;
    }
    .result-dialog[open] { display: grid; place-items: center; }
    .result-dialog::backdrop { background: rgba(2,8,16,.84); backdrop-filter: none; }
    body.goal-active::before,
    body.goal-active::after { animation-play-state: paused; }
    body.goal-active .card { backdrop-filter: none; }
    .result-panel {
      width: min(410px, calc(100% - 26px));
      padding: 31px;
      border: 1px solid rgba(185,211,237,.17);
      border-top: 2px solid var(--result-color);
      border-radius: 21px;
      background: rgba(7, 24, 43, .96);
      box-shadow: 0 28px 85px rgba(0,0,0,.6);
      text-align: center;
    }
    .result-symbol { min-height: 78px; display: grid; place-items: center; margin-bottom: 4px; }
    .result-draw { color: #dbe7f1; font: 800 3rem/1 "Barlow Condensed", sans-serif; }
    .goal-ball-runner {
      position: fixed;
      z-index: 2;
      top: calc(50% - 82px);
      left: -100px;
      width: 76px;
      height: 76px;
      display: grid;
      place-items: center;
      transform: translate3d(-50%, -50%, 0);
      will-change: left, transform;
    }
    .goal-ball {
      position: relative;
      z-index: 1;
      width: 76px;
      height: 76px;
      display: block;
      object-fit: contain;
      will-change: transform, opacity;
    }
    .ball-trail {
      position: absolute;
      z-index: 0;
      top: 50%;
      right: 58px;
      width: min(10cm, 42vw);
      height: 18px;
      border-radius: 999px 0 0 999px;
      opacity: 0;
      background:
        linear-gradient(90deg, transparent 0%, rgba(255,212,56,.055) 22%, rgba(255,235,157,.22) 66%, rgba(248,250,252,.78) 100%);
      clip-path: polygon(0 50%, 100% 0, 100% 100%);
      transform: translateY(-50%) scaleX(1);
      transform-origin: 100% 50%;
      will-change: transform, opacity;
    }
    .ball-trail::after {
      content: "";
      position: absolute;
      top: 50%;
      right: 0;
      width: 72%;
      height: 3px;
      border-radius: 999px;
      background: linear-gradient(90deg, transparent, rgba(255,212,56,.38), rgba(255,255,255,.92));
      transform: translateY(-50%);
    }
    .goal-word {
      min-height: .9em;
      display: flex;
      justify-content: center;
      color: #f8fafc;
      font: italic 800 clamp(2.25rem, 9vw, 3.15rem)/.9 "Barlow Condensed", sans-serif;
      letter-spacing: .055em;
    }
    .goal-word span {
      display: inline-block;
      opacity: 0;
      transform: scale(0);
      transform-origin: 50% 50%;
      will-change: transform, opacity;
    }
    .result-title { max-width: 320px; margin: 12px auto 0; opacity: 0; font: 800 clamp(1.35rem, 5vw, 1.7rem)/1.1 "Barlow Condensed", sans-serif; letter-spacing: .01em; }
    .result-copy { margin: 10px 0 23px; opacity: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
    .result-actions { display: grid; gap: 9px; opacity: 0; }
    .result-replay, .result-menu { width: 100%; }
    .result-menu { border-color: rgba(185,211,237,.2); color: #dce8f3; background: rgba(255,255,255,.025); }
    .result-menu:hover { border-color: rgba(255,212,56,.35); color: white; background: rgba(255,212,56,.07); }
    .result-dialog:not(.is-draw)[open] .goal-ball-runner { animation: ballTravel .92s cubic-bezier(.2,.7,.2,1) both; }
    .result-dialog:not(.is-draw)[open] .goal-ball { animation: ballSpinGrow .92s cubic-bezier(.2,.7,.2,1) both; }
    .result-dialog:not(.is-draw)[open] .ball-trail { animation: trailLife .92s cubic-bezier(.2,.7,.2,1) both; }
    .result-dialog.letters-active .goal-word span { animation: goalLetter .2s cubic-bezier(.2,.78,.3,1.22) var(--letter-delay) both; }
    .result-dialog.letters-active .result-title,
    .result-dialog.letters-active .result-copy,
    .result-dialog.letters-active .result-actions { animation: resultContent .28s .58s ease-out both; }
    .result-dialog.is-draw .goal-word { display: none; }
    .result-dialog.is-draw .result-title,
    .result-dialog.is-draw .result-copy,
    .result-dialog.is-draw .result-actions { opacity: 1; }
    @keyframes ballTravel {
      0% { left: -100px; transform: translate3d(-50%, -50%, 0); }
      100% { left: 50%; transform: translate3d(-50%, -50%, 0); }
    }
    @keyframes ballSpinGrow {
      0% { opacity: .3; transform: rotate(-650deg) scale(.16); }
      12% { opacity: 1; }
      65% { transform: rotate(-180deg) scale(.6); }
      88% { transform: rotate(-25deg) scale(.94); }
      100% { opacity: 1; transform: rotate(0) scale(1); }
    }
    @keyframes trailLife {
      0% { opacity: 0; transform: translateY(-50%) scaleX(1); }
      12% { opacity: .78; transform: translateY(-50%) scaleX(1); }
      55% { opacity: .68; transform: translateY(-50%) scaleX(.92); }
      78% { opacity: .35; transform: translateY(-50%) scaleX(.48); }
      100% { opacity: 0; transform: translateY(-50%) scaleX(0); }
    }
    @keyframes goalLetter {
      0% { opacity: 0; transform: scale(0); }
      68% { opacity: 1; transform: scale(1.3); }
      100% { opacity: 1; transform: scale(1); }
    }
    @keyframes resultContent { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

    .toast-area { position: fixed; z-index: 20; left: 50%; bottom: 24px; width: min(420px, calc(100% - 26px)); pointer-events: none; transform: translateX(-50%); }
    .toast { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; background: rgba(8,25,44,.97); box-shadow: 0 15px 40px rgba(0,0,0,.38); font-size: .77rem; font-weight: 700; animation: enter .22s ease; }
    .toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--toast-color); }
    .toast.good { --toast-color: var(--green); }
    .toast.bad { --toast-color: var(--red); }
    .toast.note { --toast-color: var(--yellow); }
    @keyframes enter { from { opacity: 0; transform: translateY(10px); } }

    .loading { min-height: 540px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }

    .feature-dialog { width: min(500px, calc(100% - 26px)); overflow: hidden; }
    .feature-dialog.wide { width: min(590px, calc(100% - 26px)); }
    .feature-modal { padding: 24px; }
    .legal-modal h2 { margin: 5px 0 0; font: 800 1.7rem/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
    .feature-copy { margin: 8px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
    .auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 20px 0 17px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
    .auth-tab { min-height: 39px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .69rem; font-weight: 800; cursor: pointer; }
    .auth-tab.active { color: #111827; background: var(--yellow); }
    .auth-pane[hidden] { display: none; }
    .field-grid { display: grid; gap: 12px; }
    .field-grid.two { grid-template-columns: 1fr 1fr; }
    .field-grid label { margin-bottom: 6px; }
    .field-hint { display: block; margin-top: 5px; color: #6f879e; font-size: .58rem; }
    .form-status { min-height: 20px; margin: 9px 0 0; color: #ff8a91; font-size: .67rem; line-height: 1.4; }
    .form-status.good { color: var(--green); }
    .full-btn { width: 100%; margin-top: 12px; }
    .legal-consent {
      display: grid;
      grid-template-columns: 18px minmax(0, 1fr);
      align-items: start;
      gap: 9px;
      margin-top: 13px;
      border: 1px solid rgba(185,211,237,.13);
      border-radius: 11px;
      padding: 11px 12px;
      background: rgba(255,255,255,.025);
    }
    .legal-consent input {
      width: 17px;
      height: 17px;
      margin: 1px 0 0;
      accent-color: var(--yellow);
      cursor: pointer;
    }
    .legal-consent label { margin: 0; color: #b9c9d8; font-size: .66rem; font-weight: 500; line-height: 1.55; }
    .legal-link {
      color: var(--yellow);
      text-decoration: underline;
      text-decoration-color: rgba(255,212,56,.42);
      text-underline-offset: 3px;
    }
    .legal-link:hover { color: white; text-decoration-color: white; }
    .legal-dialog { width: min(720px, calc(100% - 26px)); max-height: min(82dvh, 760px); overflow: hidden; }
    .legal-modal { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: min(82dvh, 760px); padding: 24px; }
    .legal-scroll {
      min-height: 0;
      overflow-y: auto;
      margin: 18px -7px 0 0;
      padding: 0 13px 4px 0;
      color: #bac9d7;
      scrollbar-color: rgba(255,212,56,.45) rgba(255,255,255,.04);
    }
    .legal-scroll h3 { margin: 20px 0 7px; color: #f4f8fb; font-size: .82rem; }
    .legal-scroll h3:first-child { margin-top: 0; }
    .legal-scroll p, .legal-scroll li { font-size: .71rem; line-height: 1.65; }
    .legal-scroll p { margin: 0 0 10px; }
    .legal-scroll ul { margin: 7px 0 12px; padding-left: 19px; }
    .legal-scroll a { color: var(--yellow); }
    .legal-version { color: #7189a0; font-size: .61rem !important; }
    .legal-close-action { justify-self: end; min-width: 112px; margin-top: 16px; }
    .profile-panel { display: grid; justify-items: center; gap: 10px; padding: 14px 0 5px; text-align: center; }
    .profile-avatar { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; color: #111827; background: var(--yellow); font: 800 1.6rem/1 "Barlow Condensed", sans-serif; }
    .profile-panel h3 { margin: 0; font: 800 1.45rem/1 "Barlow Condensed", sans-serif; }
    .profile-panel p { margin: 0; color: var(--muted); font-size: .68rem; }
    .elo-badge { border: 1px solid rgba(255,212,56,.25); border-radius: 10px; padding: 8px 12px; color: var(--yellow); background: rgba(255,212,56,.06); font: 800 .85rem/1 "Barlow Condensed", sans-serif; }
    .competition-stats { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 4px; }
    .competition-stat { border: 1px solid var(--line); border-radius: 10px; padding: 9px 5px; background: rgba(255,255,255,.025); }
    .competition-stat b { display: block; color: white; font: 800 1rem/1 "Barlow Condensed", sans-serif; }
    .competition-stat span { display: block; margin-top: 4px; color: var(--muted); font-size: .58rem; font-weight: 700; }
    .history-wrap { width: 100%; margin-top: 3px; text-align: left; }
    .history-wrap h4 { margin: 0 0 7px; color: #dce8f3; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
    .match-history { max-height: 170px; display: grid; gap: 6px; overflow-y: auto; }
    .history-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: rgba(255,255,255,.02); }
    .history-result { border-radius: 6px; padding: 4px 5px; color: white; font-size: .58rem; font-weight: 800; text-align: center; }
    .history-result.win { background: rgba(66,221,160,.16); color: #8cf0c5; }
    .history-result.loss { background: rgba(239,68,68,.14); color: #ff9a9f; }
    .history-opponent { min-width: 0; overflow: hidden; font-size: .66rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
    .history-delta { font: 800 .72rem/1 "Barlow Condensed", sans-serif; }
    .history-delta.positive { color: var(--green); }
    .history-delta.negative { color: #ff8a91; }
    .symbol-legend { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
    .symbol-key { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: #dce8f3; background: rgba(255,255,255,.025); font-size: .64rem; font-weight: 750; }
    .symbol-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
    .symbol-key.o .symbol-dot { border: 1px solid #667d94; background: #f8fafc; }
    .leaderboard-table-wrap { max-height: min(62vh, 520px); overflow: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; }
    .leaderboard-table { width: 100%; border-collapse: collapse; font-size: .69rem; }
    .leaderboard-table th { position: sticky; top: 0; z-index: 1; padding: 10px 9px; color: var(--muted); background: #0a1b31; font-size: .59rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
    .leaderboard-table td { border-top: 1px solid var(--line); padding: 10px 9px; }
    .leaderboard-table tbody tr.is-current { background: rgba(255,212,56,.07); }
    .leaderboard-rank { width: 45px; color: var(--yellow); font-weight: 800; }
    .leaderboard-elo { color: var(--yellow); font-weight: 800; white-space: nowrap; }
    .leaderboard-empty { padding: 24px !important; color: var(--muted); text-align: center; }
    .delete-account-wrap { width: 100%; border-top: 1px solid rgba(239,68,68,.2); padding-top: 13px; }
    .delete-account-wrap .btn { width: 100%; }
    .delete-account-wrap .form-status { margin-bottom: 0; text-align: left; }

    .choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 19px; }
    .choice-btn { min-height: 62px; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; color: #dfeaf4; background: rgba(255,255,255,.025); cursor: pointer; font-size: .68rem; font-weight: 800; }
    .choice-btn:hover, .choice-btn.selected { color: #111827; border-color: var(--yellow); background: var(--yellow); }
    .difficulty-wrap { margin-top: 18px; }
    .difficulty-wrap[hidden] { display: none; }
    .difficulty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .difficulty-grid .choice-btn { min-height: 54px; }
    .difficulty-grid small { display: block; margin-top: 3px; opacity: .7; font-size: .55rem; }

    .room-status { margin: 18px 0 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; padding: 13px; color: #dfeaf4; background: rgba(255,255,255,.025); font-size: .7rem; line-height: 1.45; }
    .room-link-row { display: grid; grid-template-columns: minmax(0,1fr) 43px 94px; gap: 7px; }
    .room-link {
      height: 44px;
      display: flex;
      align-items: center;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.11);
      border-radius: 10px;
      padding: 0 12px;
      color: #cbd9e5;
      background: #061426;
      font-size: .66rem;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .icon-btn { width: 43px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: white; background: rgba(255,255,255,.035); cursor: pointer; }
    .copy-btn { height: 44px; padding: 0 12px; }
    .queue-body { display: grid; justify-items: center; gap: 15px; padding: 20px 0 4px; text-align: center; }
    .queue-spinner { width: 58px; height: 58px; border: 4px solid rgba(255,255,255,.1); border-top-color: var(--yellow); border-radius: 50%; animation: spin .8s linear infinite; }
    .queue-body h3 { margin: 0; font: 800 1.5rem/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
    .queue-body p { max-width: 330px; margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
    @keyframes spin { to { transform: rotate(360deg); } }

    .site-footer {
      position: relative;
      z-index: 1;
      width: min(1280px, calc(100% - 28px));
      margin: -18px auto 0;
      padding: 0 0 30px;
      color: #758ba0;
      text-align: center;
    }
    .footer-panel {
      border-top: 1px solid rgba(185,211,237,.12);
      padding: 22px 16px 0;
    }
    .footer-notice { max-width: 850px; margin: 0 auto; font-size: .66rem; line-height: 1.65; }
    .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 19px; margin-top: 13px; }
    .footer-links a { color: #c1d0de; font-size: .66rem; font-weight: 700; text-decoration: none; }
    .footer-links a:hover { color: var(--yellow); }
    .footer-meta { margin: 11px 0 0; color: #60778d; font-size: .59rem; }

    .cookie-banner {
      position: fixed;
      z-index: 30;
      left: 50%;
      bottom: 18px;
      width: min(720px, calc(100% - 28px));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      border: 1px solid rgba(255,212,56,.25);
      border-radius: 15px;
      padding: 13px 14px 13px 17px;
      color: #dce7f1;
      background: rgba(7,20,38,.97);
      box-shadow: 0 18px 55px rgba(0,0,0,.52);
      backdrop-filter: blur(14px);
      animation: cookieEnter .28s ease-out both;
    }
    .cookie-banner[hidden] { display: none; }
    .cookie-copy { margin: 0; font-size: .7rem; line-height: 1.55; }
    .cookie-copy .legal-link { margin-left: 4px; white-space: nowrap; }
    .cookie-banner .btn { min-width: 104px; flex: 0 0 auto; }
    body.cookie-notice-visible .toast-area { bottom: 105px; }
    @keyframes cookieEnter { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

    /* 100% tarayıcı yakınlığında oyun tahtasını kısa dizüstü ekranlara da sığdır. */
    @media (min-width: 621px) and (max-height: 950px) {
      .app { padding: 12px 0 24px; }
      .topbar { margin-bottom: 10px; }
      .brand-ball { width: 45px; height: 45px; }
      .identity-chip, .auth-entry, .btn { min-height: 42px; }
      .mode-option { min-height: 40px; }
      .play-lobby { margin-bottom: 10px; padding: 13px; }
      .play-lobby-head { margin-bottom: 10px; }
      .play-card { min-height: 66px; padding: 9px; }
      .game-card {
        padding: 16px;
      }
      .board-meta { min-height: 32px; margin-bottom: 10px; }
      .board {
        grid-template-columns: 116px repeat(3, minmax(0, 1fr));
        grid-template-rows: clamp(92px, 11.3vh, 101px) repeat(3, clamp(137px, 16.6vh, 150px));
        gap: 7px;
      }
      .corner, .team, .square { border-radius: 14px; }
      .team { padding: 6px; }
      .badge { width: 44px; height: 44px; }
      .move-symbol, .symbol-cleats, .symbol-o-image { width: 74px; height: 74px; }
      .side { gap: 12px; }
      .side .card { padding: 16px; }
      .help { gap: 10px; }
    }

    @media (max-width: 930px) {
      .layout { grid-template-columns: 1fr; }
      .side { grid-template-columns: 1fr 1fr; }
      .play-grid { grid-template-columns: repeat(2, 1fr); }
    }
    @media (max-width: 860px) {
      .topbar { flex-wrap: wrap; }
      .mode-switch { order: 3; width: 100%; }
      .mode-option { flex: 1; }
    }
    @media (max-width: 620px) {
      .app { width: calc(100% - 20px); padding-top: 18px; }
      .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; }
      .brand { min-width: 0; gap: 10px; }
      .brand-ball { width: 43px; height: 43px; }
      .brand-tagline { display: none; }
      h1 { font-size: clamp(1.3rem, 6.7vw, 1.55rem); white-space: nowrap; }
      .actions { grid-column: 1 / -1; grid-row: 2; justify-content: flex-end; }
      .mode-switch { grid-column: 1 / -1; grid-row: 3; order: initial; }
      .actions .label { display: none; }
      .actions .btn { width: 44px; padding: 0; }
      .identity-chip { min-width: 104px; padding: 5px 9px 5px 5px; }
      .identity-chip .account-copy strong { max-width: 92px; }
      .identity-chip .account-copy span:empty { display: none; }
      .auth-entry { min-height: 43px; padding: 0 10px; font-size: .62rem; }
      .play-lobby-head { align-items: flex-start; flex-direction: column; }
      .session-summary { white-space: normal; }
      .game-card { padding: 11px; }
      .board-scroll { overflow-x: visible; }
      .board {
        width: 100%;
        min-width: 0;
        grid-template-columns: 62px repeat(3, minmax(0, 1fr));
        grid-template-rows: 70px repeat(3, 98px);
        gap: 4px;
      }
      .corner, .team, .square { border-radius: 10px; }
      .board .team { flex-direction: column; gap: 3px; padding: 4px 2px; text-align: center; }
      .badge { width: 29px; height: 29px; font-size: .6rem; }
      .team-name {
        display: -webkit-box;
        overflow: hidden;
        font-size: .56rem;
        line-height: 1.12;
        text-overflow: clip;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
      .square { gap: 4px; padding: 2px; }
      .square::after { inset: 5px; }
      .square .move-symbol, .square .symbol-cleats, .square .symbol-o-image { width: 45px; height: 45px; }
      .answer { width: calc(100% - 6px); font-size: .56rem; }
      .competition-stats { grid-template-columns: repeat(2, 1fr); }
      .leaderboard-table th, .leaderboard-table td { padding: 9px 6px; }
      .side { grid-template-columns: 1fr; }
      .play-grid { grid-template-columns: 1fr; }
      .play-card { min-height: 62px; }
      .choice-grid { grid-template-columns: repeat(2, 1fr); }
      .field-grid.two { grid-template-columns: 1fr; }
      .legal-modal { padding: 19px; }
      .legal-scroll { margin-top: 15px; }
      .site-footer { width: calc(100% - 20px); margin-top: -8px; }
      .cookie-banner { align-items: stretch; flex-direction: column; gap: 10px; bottom: 10px; padding: 14px; }
      .cookie-banner .btn { width: 100%; }
      body.cookie-notice-visible .toast-area { bottom: 154px; }
      .room-link-row { grid-template-columns: minmax(0,1fr) 43px; }
      .room-link-row .copy-btn { grid-column: 1 / -1; width: 100%; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
      .result-dialog:not(.is-draw)[open] .goal-ball-runner,
      .result-dialog:not(.is-draw)[open] .goal-ball,
      .result-dialog:not(.is-draw)[open] .ball-trail {
        animation-duration: .92s !important;
      }
      .result-dialog.letters-active .goal-word span {
        animation-duration: .2s !important;
        animation-delay: var(--letter-delay) !important;
      }
      .result-dialog.letters-active .result-title,
      .result-dialog.letters-active .result-copy,
      .result-dialog.letters-active .result-actions {
        animation-duration: .28s !important;
        animation-delay: .58s !important;
      }
    }
