/* Shared styles for index.html and flag-of-the-day.html */
  :root {
    --bg: #6d28d9;
    --card: #fffdf7;
    --ink: #18181b;
    --muted: #5b5563;
    --soft: #f1ece2;
    --pink: #fb7185;
    --yellow: #facc15;
    --blue: #3b82f6;
    --green: #22c55e;
    --edge: 2.5px solid var(--ink);
    --lift: 4px 4px 0 var(--ink);
    --ad-h: 90px;
    color-scheme: light;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; }
  body {
    min-height: 100svh;
    background-color: var(--bg);
    background-image: radial-gradient(rgba(139, 92, 246, .5) 15%, transparent 16%);
    background-size: 30px 30px;
    color: var(--ink);
    font: 700 1rem/1.5 Verdana, sans-serif;
    display: flex; flex-direction: column;
  }
  h1, h2, .display { font-family: Verdana, sans-serif; font-weight: 900; margin: 0; }
  button { font: inherit; color: inherit; cursor: pointer; }

  /* Floating shapes from the original */
  #shape-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
  .bg-shape { position: absolute; opacity: .9; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); animation: float linear infinite; }
  .bg-shape.triangle { border: none; box-shadow: none; background: transparent; filter: drop-shadow(6px 6px 0 var(--ink)); }
  @keyframes float { 50% { transform: translate(20px, 40px) rotate(10deg); } }
  @keyframes spin { to { transform: rotate(360deg); } }
  .s1 { top: 10%; left: 5%; width: 60px; height: 60px; background: var(--pink); animation-duration: 18s; }
  .s2 { top: 20%; right: 10%; width: 90px; height: 90px; background: var(--yellow); border-radius: 50%; animation-duration: 25s; }
  .s3 { bottom: 30%; left: 8%; width: 0; height: 0; border-left: 40px solid transparent !important; border-right: 40px solid transparent !important; border-bottom: 80px solid #60a5fa !important; animation-duration: 20s; }
  .s4 { bottom: 15%; right: 5%; width: 120px; height: 30px; background: #4ade80; transform: rotate(-45deg); animation-duration: 30s; }
  .s5 { top: 50%; left: -40px; width: 80px; height: 80px; background: transparent; border: 15px solid #fb923c; border-radius: 50%; animation: spin 20s linear infinite; box-shadow: 6px 6px 0 rgba(0,0,0,.2); }
  .s6 { top: 8%; left: 45%; width: 35px; height: 35px; background: #60a5fa; border-radius: 50%; animation-duration: 15s; }
  .s7 { bottom: 45%; right: -20px; width: 100px; height: 100px; background: var(--pink); transform: rotate(15deg); animation-duration: 22s; }
  .s8 { top: 85%; left: 40%; width: 25px; height: 25px; background: var(--yellow); border-radius: 50%; animation-duration: 12s; }

  /* The original Flagging Rights wordmark */
  .app-title { font-family: Verdana, sans-serif; font-size: 3.2rem; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--ink); text-shadow: 3px 3px 0 var(--pink); line-height: 1; letter-spacing: 0; transform: rotate(-2deg); margin: 4px 0 18px; }
  @media (max-width: 420px) { .app-title { font-size: 2.6rem; } }
  .btn-lb { background: var(--yellow); width: 100%; margin-top: 12px; }

  main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px 32px; }
  @media (min-height: 760px) { main { align-items: center; } }

  .card {
    width: 100%; max-width: 520px; background: var(--card);
    border: 3px solid var(--ink); border-radius: 10px; box-shadow: 15px 15px 0 rgba(0,0,0,.25);
    padding: 24px;
  }
  @media (min-width: 560px) { .card { padding: 32px; } }
  .view { display: none; }
  .view.on { display: block; animation: rise .25s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  /* Menu */
  .hello p { margin: 0 0 18px; color: #555; }
  .group { margin-bottom: 16px; }
  .group-label { font-size: .8rem; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: #555; margin-bottom: 6px; }
  .seg { display: flex; background: var(--soft); border: var(--edge); border-radius: 12px; padding: 3px; gap: 3px; }
  .seg button {
    flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px;
    font-weight: 900; font-size: .8rem; text-transform: uppercase; white-space: nowrap; transition: background-color .15s ease;
  }
  .seg button:hover { background: rgba(0,0,0,.06); }
  .seg button.on { background: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--pink); }
  .field {
    width: 100%; font: inherit; font-size: 16px; font-weight: 600; padding: 12px 14px;
    border: var(--edge); border-radius: 12px; background: #fff; color: var(--ink); outline: none;
  }
  .field:focus { box-shadow: 0 0 0 3px rgba(59,130,246,.35); }
  .hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: var(--edge); border-radius: 14px; padding: 14px 18px;
    font-weight: 900; font-size: 1rem; text-transform: uppercase; background: #fff; box-shadow: var(--lift);
    transition: transform .1s ease, box-shadow .1s ease;
  }
  .btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
  .btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
  .btn-go { background: var(--ink); color: #fff; width: 100%; font-size: 1.5rem; padding: 16px; box-shadow: 5px 5px 0 var(--pink); }
  .btn-go:hover { box-shadow: 6px 6px 0 var(--pink); }
  .btn-go:active { box-shadow: 0 0 0 var(--pink); }
  .btn-row { display: flex; gap: 10px; margin-top: 14px; }
  .btn-row .btn { flex: 1; }
  .btn-small { padding: 10px 12px; font-size: .95rem; }

  /* Game */
  .hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
  .pill { font: 900 1.2rem/1.4 Verdana, sans-serif; text-transform: uppercase; }
  .pill.time { background: var(--ink); color: var(--yellow); min-width: 72px; text-align: center; padding: 4px 12px; transform: skew(-10deg); text-transform: none; }
  .pill.time.low { background: var(--pink); color: var(--ink); }
  .bar { height: 8px; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; background: var(--soft); margin-bottom: 18px; }
  .bar i { display: block; height: 100%; width: 100%; background: var(--yellow); transform-origin: left; transition: transform .25s linear; }
  .stage { height: 200px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
  .stage img { max-width: 100%; max-height: 100%; filter: drop-shadow(5px 5px 0 var(--ink)); }
  .prompt { font: 900 clamp(1.2rem, 5vw, 1.5rem)/1.25 Verdana, sans-serif; text-transform: uppercase; text-align: center; padding: 14px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 rgba(0,0,0,.1); }
  .prompt small { display: block; font: 700 .8rem Verdana, sans-serif; color: #555; margin-bottom: 6px; }
  .feedback { height: 34px; text-align: center; font-weight: 900; font-size: 1.15rem; margin-bottom: 10px; transform: rotate(-2deg); }
  .feedback span { display: inline-block; padding: 3px 14px; border-radius: 4px; color: #fff; background: var(--ink); box-shadow: 3px 3px 0 var(--pink); }
  .feedback .yes { background: #3b82f6; }
  .feedback .no { background: var(--pink); box-shadow: 3px 3px 0 var(--ink); }
  .type-row { display: flex; gap: 8px; }
  .type-row .field { flex: 1; text-align: center; }
  .type-row .btn { padding: 0 18px; background: var(--blue); color: #fff; }
  .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .choices .btn { min-height: 64px; font-size: .98rem; line-height: 1.2; padding: 10px; background: #fff; text-align: center; }
  .choices .btn.yes { background: var(--green); }
  .choices .btn.no { background: var(--pink); }
  .pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
  @keyframes pop { 50% { transform: scale(1.08); } }
  .shake { animation: shake .35s ease-in-out; }
  @keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

  /* End */
  .end { text-align: center; }
  .end h2 { font-size: 2.5rem; line-height: 1; text-transform: uppercase; color: var(--pink); text-shadow: 3px 3px 0 var(--ink); }
  .big-score { font: 900 5.5rem/1 Verdana, sans-serif; margin: 14px 0 6px; color: var(--yellow); text-shadow: 4px 4px 0 var(--ink); -webkit-text-stroke: 2px var(--ink); }
  .end .sub { color: var(--muted); margin: 0 0 6px; }
  .saved { min-height: 24px; font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
  .badge { display: inline-block; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 10px; font-weight: 800; margin-top: 6px; }

  /* Leaderboard */
  .lb h2, .privacy h2 { font-size: 1.9rem; margin-bottom: 14px; text-transform: uppercase; color: #3b82f6; text-shadow: 2px 2px 0 var(--ink); }
  .lb .seg { margin-bottom: 8px; }
  .lb-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 2px solid var(--ink); min-height: 120px; }
  .lb-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #e6dfd2; }
  .lb-list .rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--soft); flex: none; }
  .lb-list li:nth-child(1) .rank { background: var(--yellow); border: 2px solid var(--ink); }
  .lb-list li:nth-child(2) .rank { background: #d4d4d8; border: 2px solid var(--ink); }
  .lb-list li:nth-child(3) .rank { background: #f0a36e; border: 2px solid var(--ink); }
  .lb-list .name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lb-list .pts { font: 900 1.1rem Verdana, sans-serif; }
  .lb-empty { color: var(--muted); text-align: center; padding: 28px 8px; font-weight: 600; }

  /* Privacy */
  .privacy .scroll { max-height: 48svh; overflow-y: auto; font-size: .92rem; color: #3f3a45; padding-right: 6px; }
  .privacy h3 { font-size: 1rem; margin: 16px 0 4px; }
  .privacy p { margin: 0 0 8px; }

  footer { text-align: center; color: rgba(255,255,255,.75); font-size: .85rem; padding: 0 16px 20px; }
  footer a { color: #fff; }
  footer button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; font-size: .85rem; }

  /* Ad banner */
  .ad-banner { position: fixed; left: 0; right: 0; bottom: 0; height: 0; display: flex; justify-content: center; align-items: center; z-index: 100; overflow: hidden; }
  body:has(ins.adsbygoogle[data-ad-status="filled"]) { padding-bottom: var(--ad-h); }
  body:has(ins.adsbygoogle[data-ad-status="filled"]) .ad-banner { height: var(--ad-h); background: #fff; border-top: var(--edge); }
  .flagging-ad { display: inline-block; width: 728px; height: 90px; }
  /* Sideways phones: no room for an ad strip under the menu */
  @media (max-height: 500px) {
    body:has(ins.adsbygoogle[data-ad-status="filled"]) { padding-bottom: 0; }
    body:has(ins.adsbygoogle[data-ad-status="filled"]) .ad-banner { height: 0; border: 0; }
  }
  @media (max-width: 800px) {
    :root { --ad-h: 60px; }
    .flagging-ad { width: 320px; height: 50px; }
    .floatingchat-container-wrap, .floatingchat-container-wrap-mobi { display: none !important; }
  }
  /* Shorter screens: keep the whole menu on one screen, no scrolling */
  @media (max-height: 900px) {
    main { padding: 16px 16px 12px; }
    .app-title { margin-bottom: 16px; }
    .hello p, .hint { display: none; }
    .group { margin-bottom: 11px; }
    .group-label { margin-bottom: 4px; }
    .seg button { padding: 8px 6px; }
    .field { padding: 10px 14px; }
  }
  /* Short screens (small laptops, phones in landscape): shrink so the menu still fits */
  @media (max-height: 760px) {
    main { padding-top: 10px; padding-bottom: 8px; }
    .app-title { font-size: 2.3rem; margin-bottom: 12px; }
    .group { margin-bottom: 9px; }
    .seg button { padding: 7px 6px; }
    .field { padding: 8px 14px; }
    .btn-go { padding: 11px; font-size: 1.3rem; }
    .btn-lb { padding: 9px; margin-top: 10px; }
    footer { padding-bottom: 10px; }
  }
  @media (max-height: 700px) {
    .card { padding: 18px 20px; }
    .app-title { font-size: 2rem; margin-bottom: 10px; }
    .group-label { font-size: .72rem; margin-bottom: 3px; }
    footer { padding: 0 16px 6px; font-size: .8rem; }
  }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
