/* ================================================================
   Team Sweden – chatt
   Färger uppmätta direkt ur spelets skärmbilder (lobby + teamchatt).
   ================================================================ */

@font-face { font-family: "Lilita"; font-display: swap; src: url(fonts/lilita-one-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lilita"; font-display: swap; src: url(fonts/lilita-one-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url(fonts/fredoka-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FEFF; }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url(fonts/fredoka-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+FEFF; }
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url(fonts/fredoka-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url(fonts/fredoka-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }

:root {
  /* text */
  --ink: #304466;           /* spelets meddelandetext */
  --ink-2: #4f6288;
  --muted: #8592b3;
  --time: #8aaa5c;          /* "34min ago" */

  /* guld (ramar, etiketter) */
  --gold-hi: #fffbe9;
  --gold-1: #ffe27a;
  --gold-2: #ffcf3a;
  --gold-3: #ffc12e;
  --gold-4: #f29a18;
  --gold-edge: #c26a0c;
  --gold-deep: #8a4306;

  /* blå knappar (Info) */
  --info-hi: #9ad6ff;
  --info-1: #4eadf7;
  --info-2: #377df2;
  --info-3: #2f68e6;
  --info-4: #2554ca;
  --info-edge: #173f9a;
  --info-deep: #0f2c70;

  /* lobbyns fyrkantsknappar */
  --sq-rim-1: #b6ffff;
  --sq-rim-2: #53cfff;
  --sq-1: #14cbff;
  --sq-2: #0b8ff8;
  --sq-3: #0b5ce0;
  --sq-edge: #0a3f9e;

  /* grön (Request) */
  --green-hi: #c9f58a;
  --green-1: #87d744;
  --green-2: #66b538;
  --green-3: #5aa733;
  --green-4: #3f8224;
  --green-edge: #245810;

  /* rosa band */
  --rib-1: #ef5a8a;
  --rib-2: #d43f70;
  --rib-3: #bf375c;
  --rib-edge: #7c1636;

  /* turkos etikett */
  --teal-1: #3ff0f2;
  --teal-2: #1ed9df;
  --teal-3: #07b0bb;
  --teal-edge: #0f4b66;

  /* röd */
  --red-1: #ff7a98;
  --red-2: #e1406d;
  --red-3: #c62953;
  --red-edge: #6e0f27;

  /* chatytan */
  --chat-bg: #3158b3;
  --chat-scale: #2b4b9f;
  --chat-deep: #213782;

  /* HUD-kapslar */
  --hud: rgba(16, 70, 120, .78);
  --hud-edge: rgba(0, 32, 70, .55);

  --font-fun: "Lilita", "Fredoka", system-ui, sans-serif;
  --font-ui: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Färg per medlem – samma typ av klara namnfärger som i spelet */
.pc0 { --c-hi: #d4ff8f; --c-1: #8fe04a; --c-2: #47b51f; --c-dk: #1b5c09; }
.pc1 { --c-hi: #fff4b0; --c-1: #ffd23a; --c-2: #f5a90c; --c-dk: #7a3a04; }
.pc2 { --c-hi: #ffc9dc; --c-1: #ff6f9f; --c-2: #e1406d; --c-dk: #6e0f27; }
.pc3 { --c-hi: #c2fbff; --c-1: #3fe3ee; --c-2: #0fb2cf; --c-dk: #0b4a66; }
.pc4 { --c-hi: #ead4ff; --c-1: #b884ff; --c-2: #8a4cf0; --c-dk: #3b1580; }
.pc5 { --c-hi: #ffdcb0; --c-1: #ffa545; --c-2: #f2760f; --c-dk: #7a3000; }
.pc6 { --c-hi: #ffc4c4; --c-1: #ff6b6b; --c-2: #e02b3a; --c-dk: #6e0f18; }
.pc7 { --c-hi: #c8e8ff; --c-1: #4eadf7; --c-2: #2f68e6; --c-dk: #102f7a; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  font-family: var(--font-ui); font-weight: 500; font-size: 16px; line-height: 1.4; color: var(--ink);
  background: #2a8fd8;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }

/* Konturtext (tjock kant + skugga under, som all text i spelet) */
.ot, .title, .panel-title, .ribbon-text, .tab-label, .btn, .hud-val, .who, .avatar, .tab-dot, .time, .empty-chat b, .rules-body h3, .member-group, .popup .lead {
  text-shadow:
    calc(var(--ow, 2px) * -1) calc(var(--ow, 2px) * -1) 0 var(--o, #173f9a),
    var(--ow, 2px) calc(var(--ow, 2px) * -1) 0 var(--o, #173f9a),
    calc(var(--ow, 2px) * -1) var(--ow, 2px) 0 var(--o, #173f9a),
    var(--ow, 2px) var(--ow, 2px) 0 var(--o, #173f9a),
    0 calc(var(--ow, 2px) * -1.2) 0 var(--o, #173f9a),
    calc(var(--ow, 2px) * -1.2) 0 0 var(--o, #173f9a),
    calc(var(--ow, 2px) * 1.2) 0 0 var(--o, #173f9a),
    0 calc(var(--ow, 2px) * 2.2) 0 var(--o, #173f9a);
}

/* =================================================================
   Bakgrund: spelets undervattensscen + ljus + partiklar
   ================================================================= */
.scene {
  position: fixed; inset: -12px; z-index: 0;
  background-image: url(img/scene.jpg);
  background-image: image-set(url(img/scene.webp) type("image/webp"), url(img/scene.jpg) type("image/jpeg"));
  background-size: cover; background-position: 28% 100%;
  filter: blur(2px) saturate(1.08);
  transform: scale(1.02);
}
.scene::after { /* mjuk ton så panelerna lyfter */
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(160,240,255,.35), transparent 70%),
    linear-gradient(180deg, rgba(20,110,190,.15) 0%, rgba(20,60,140,.1) 60%, rgba(10,30,90,.35) 100%);
}
.caustics { /* rörligt ljusspel i vattnet */
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .32; mix-blend-mode: soft-light;
  background:
    radial-gradient(ellipse 30% 18% at 20% 30%, #fff, transparent 70%),
    radial-gradient(ellipse 22% 14% at 70% 20%, #fff, transparent 70%),
    radial-gradient(ellipse 26% 16% at 45% 70%, #fff, transparent 70%),
    radial-gradient(ellipse 18% 12% at 85% 65%, #fff, transparent 70%);
  background-size: 140% 140%;
  animation: caustics 22s ease-in-out infinite alternate;
}
@keyframes caustics { from { background-position: 0% 0%; } to { background-position: 100% 60%; } }

.sea { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sea::before { /* ljusstrålar */
  content: ""; position: absolute; left: -30%; right: -30%; top: -25%; height: 100%;
  background: conic-gradient(from 166deg at 50% 0%,
    transparent 0deg, rgba(255,255,255,.22) 3deg, transparent 7deg,
    transparent 10deg, rgba(255,255,255,.14) 13deg, transparent 18deg,
    transparent 21deg, rgba(255,255,255,.2) 24deg, transparent 28deg, transparent 360deg);
  -webkit-mask-image: linear-gradient(180deg, #000 5%, transparent 80%); mask-image: linear-gradient(180deg, #000 5%, transparent 80%);
  transform-origin: 50% 0; animation: rays 14s ease-in-out infinite alternate;
}
@keyframes rays { from { transform: rotate(-4deg); opacity: .7; } to { transform: rotate(4deg); opacity: 1; } }
.sea span { /* bubblor */
  position: absolute; bottom: -40px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0 11%, rgba(255,255,255,.15) 28%, rgba(200,240,255,.08) 60%, rgba(255,255,255,.55) 69%, transparent 72%);
  animation: rise linear infinite; opacity: 0;
}
.sea span:nth-child(odd) { width: 6px !important; height: 6px !important; background: radial-gradient(circle, #fff 0 30%, rgba(255,255,255,0) 70%); filter: blur(.3px); }
.sea span:nth-child(1) { left: 6%;  width: 22px; height: 22px; animation-duration: 20s; animation-delay: 0s; }
.sea span:nth-child(2) { left: 17%; width: 14px; height: 14px; animation-duration: 17s; animation-delay: 5s; }
.sea span:nth-child(3) { left: 30%; width: 28px; height: 28px; animation-duration: 26s; animation-delay: 10s; }
.sea span:nth-child(4) { left: 48%; width: 16px; height: 16px; animation-duration: 19s; animation-delay: 2s; }
.sea span:nth-child(5) { left: 63%; width: 24px; height: 24px; animation-duration: 23s; animation-delay: 13s; }
.sea span:nth-child(6) { left: 78%; width: 12px; height: 12px; animation-duration: 16s; animation-delay: 7s; }
.sea span:nth-child(7) { left: 90%; width: 18px; height: 18px; animation-duration: 21s; animation-delay: 1s; }
.sea span:nth-child(8) { left: 40%; width: 26px; height: 26px; animation-duration: 25s; animation-delay: 16s; }
@keyframes rise {
  0% { transform: translate(0,0); opacity: 0; } 8% { opacity: .95; }
  33% { transform: translate(12px,-36vh); } 66% { transform: translate(-10px,-74vh); } 92% { opacity: .8; }
  100% { transform: translate(6px,-112vh); opacity: 0; }
}

/* =================================================================
   Byggstenar
   ================================================================= */
.title { --o: #4b1f7a; --ow: 2.5px; font-family: var(--font-fun); font-weight: 400; color: #fff; margin: 0; line-height: 1.05; letter-spacing: .6px; }

/* Guldram (tjock, rundad, glansig, mörk kant och 3D-botten) */
.goldframe { position: relative; }
.goldframe::before {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: var(--r-out, 34px);
  background: linear-gradient(180deg, #fffbe0 0%, #ffef93 12%, #ffdc4e 34%, var(--gold-3) 66%, var(--gold-4) 100%);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.85),
    inset 0 -4px 0 rgba(150,60,10,.35),
    0 0 0 2.5px var(--gold-edge),
    0 6px 0 2.5px var(--gold-deep),
    0 16px 32px rgba(5,25,80,.45);
}
.goldframe > * { position: relative; z-index: 1; }

/* Glansiga 3D-knappar */
.btn {
  --b-hi: var(--info-hi); --b-1: var(--info-1); --b-2: var(--info-2); --b-3: var(--info-3); --b-4: var(--info-4); --b-edge: var(--info-edge); --b-deep: var(--info-deep);
  --o: var(--b-edge); --ow: 1.6px;
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 999px; padding: 10px 24px 12px;
  font-family: var(--font-fun); font-size: 20px; letter-spacing: .5px; color: #fff; line-height: 1;
  background: linear-gradient(180deg, var(--b-hi) 0%, var(--b-1) 22%, var(--b-2) 55%, var(--b-3) 80%, var(--b-4) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.75),
    inset 0 -5px 0 rgba(0,0,0,.12),
    0 0 0 2.5px var(--b-edge),
    0 5px 0 2.5px var(--b-deep),
    0 9px 14px rgba(3,20,70,.35);
  transition: transform .1s cubic-bezier(.3,1.6,.5,1), box-shadow .1s, filter .15s;
}
.btn::before { /* blank glansfläck överst */
  content: ""; position: absolute; left: 10%; right: 10%; top: 3px; height: 42%; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,.08)); pointer-events: none;
}
.btn > * { position: relative; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px) scale(.97); box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -3px 0 rgba(0,0,0,.12), 0 0 0 2.5px var(--b-edge), 0 1px 0 2.5px var(--b-deep), 0 3px 6px rgba(3,20,70,.3); }
.btn:disabled { filter: grayscale(.5) brightness(.95); cursor: default; }
.btn-green { --b-hi: var(--green-hi); --b-1: var(--green-1); --b-2: var(--green-2); --b-3: var(--green-3); --b-4: var(--green-4); --b-edge: var(--green-edge); --b-deep: #153a06; }
.btn-sm { font-size: 17px; padding: 8px 16px 10px; }
.btn-lg { font-size: 25px; padding: 13px 34px 15px; }
.btn-ico { width: 22px; height: 22px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }

/* Glimt som sveper över guld/gröna element ibland */
@keyframes glint { 0%, 82% { transform: translateX(-160%) skewX(-20deg); } 100% { transform: translateX(260%) skewX(-20deg); } }

/* =================================================================
   Popup (låst sida, namnval) – som spelets dialogrutor
   ================================================================= */
.popup { --r-out: 38px; padding: 10px; width: 100%; max-width: 430px; }
.popup-inner {
  position: relative; border-radius: 29px; padding: 0 22px 26px; text-align: center; color: #fff; overflow: visible;
  background: linear-gradient(180deg, #6cc4ff 0%, var(--info-1) 18%, var(--info-2) 60%, var(--info-4) 100%);
  box-shadow: 0 0 0 2.5px var(--gold-edge), inset 0 4px 0 rgba(255,255,255,.35), inset 0 -8px 16px rgba(10,40,120,.35);
}
.popup-hero { margin: 0 -22px; height: 150px; border-radius: 29px 29px 0 0; overflow: hidden; position: relative;
  box-shadow: inset 0 -3px 0 rgba(10,40,120,.25); }
.popup-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; display: block; }
.popup-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 60px; background: linear-gradient(180deg, transparent, var(--info-1)); }
.popup .crest-lg { margin-top: -54px; }
.popup .title { font-size: 34px; margin-bottom: 12px; }
.popup p { margin: 0 0 8px; font-size: 17px; text-shadow: 0 1.5px 0 rgba(10,40,120,.5); }
.popup .lead { --o: var(--info-edge); --ow: 1.6px; font-family: var(--font-fun); font-size: 22px; letter-spacing: .4px; margin-bottom: 12px; }

.gate { position: relative; z-index: 1; min-height: 100%; display: grid; place-items: center; padding: 24px; overflow: auto; }

.crest { width: 60px; height: 60px; flex: none; filter: drop-shadow(0 4px 0 rgba(0,0,0,.25)); }
.crest svg { width: 100%; height: 100%; }
.crest-lg { position: relative; width: 104px; height: 104px; margin: 0 auto 4px; animation: bob 5s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.stars { display: flex; gap: 1px; justify-content: center; }
.stars i {
  width: 18px; height: 18px; display: block;
  background: linear-gradient(180deg, #fffde0, var(--gold-1) 40%, #f5a90c);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  filter: drop-shadow(0 1.5px 0 var(--gold-deep));
  animation: twinkle 4s ease-in-out infinite;
}
.stars i:nth-child(2) { animation-delay: .4s; } .stars i:nth-child(3) { animation-delay: .8s; }
.stars i:nth-child(4) { animation-delay: 1.2s; } .stars i:nth-child(5) { animation-delay: 1.6s; }
@keyframes twinkle { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.3) rotate(15deg); } }

/* =================================================================
   App-skal & HUD
   ================================================================= */
.app {
  position: relative; z-index: 1; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; max-width: 1200px; margin: 0 auto;
  padding: 10px 12px calc(12px + var(--safe-b));
}

.hud {
  position: relative; display: grid; align-items: center; gap: 10px 12px; padding: 2px 4px 14px;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas: "me online . gear" "brand brand brand tabs";
}
.me-btn { grid-area: me; border: 0; background: none; padding: 0; }
.hud-pill { grid-area: online; justify-self: start; }
.brand { grid-area: brand; }
.tabs { grid-area: tabs; }
.gear-btn { grid-area: gear; justify-self: end; }

/* HUD-kapsel med ikon som sticker ut till vänster (som hjärtat/myntet i lobbyn) */
.hud-pill {
  position: relative; display: inline-flex; align-items: center; height: 36px; margin-left: 14px;
  border: 0; border-radius: 999px; padding: 0 16px 0 34px;
  background: linear-gradient(180deg, rgba(10,50,95,.82), var(--hud));
  box-shadow: inset 0 2px 4px rgba(0,0,0,.3), 0 0 0 1.5px var(--hud-edge), 0 1px 0 2px rgba(255,255,255,.12);
}
.hud-icon { position: absolute; left: -18px; top: 50%; width: 48px; height: 48px; transform: translateY(-50%); filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }
.hud-val { --o: #06243f; --ow: 1.5px; font-family: var(--font-fun); font-size: 19px; letter-spacing: .5px; color: #fff; white-space: nowrap; }

.gear-btn {
  width: 50px; height: 50px; border: 0; border-radius: 50%; padding: 6px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #6fd2ff, #23b9fd 45%, #009cfc 75%, #0772d6);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -4px 0 rgba(0,0,0,.15), 0 0 0 2.5px #0a4fa6, 0 4px 0 2.5px #083a7c;
  transition: transform .2s cubic-bezier(.3,1.6,.5,1);
}
.gear-btn svg { width: 100%; height: 100%; }
.gear-btn:hover { transform: rotate(30deg); }
.gear-btn:active { transform: rotate(60deg) scale(.92); }

/* Profilruta med guldram */
.avatar {
  --o: var(--c-dk, #102f7a); --ow: 1.6px;
  width: 54px; height: 54px; flex: none; border-radius: 15px; position: relative;
  display: grid; place-items: center;
  font-family: var(--font-fun); font-size: 27px; color: #fff; line-height: 1;
  background:
    radial-gradient(ellipse 85% 45% at 50% 8%, rgba(255,255,255,.75), rgba(255,255,255,0) 72%),
    linear-gradient(180deg, var(--c-hi, #c8e8ff), var(--c-1, #4eadf7) 40%, var(--c-2, #2f68e6));
  box-shadow:
    0 0 0 2.5px #fffbe0,
    0 0 0 5.5px var(--gold-2),
    0 0 0 7.5px var(--gold-edge),
    0 5px 0 7.5px var(--gold-deep),
    0 9px 14px 7px rgba(3,20,70,.25);
}
.me-btn .avatar { width: 50px; height: 50px; font-size: 25px; margin: 8px; }
.avatar.xs { width: 34px; height: 34px; font-size: 18px; border-radius: 10px;
  box-shadow: 0 0 0 2px #fffbe0, 0 0 0 4px var(--gold-2), 0 0 0 5.5px var(--gold-edge), 0 3px 0 5.5px var(--gold-deep); }

/* Sköld + rosa band */
.brand { position: relative; display: flex; align-items: center; min-width: 0; padding-bottom: 6px; }
.brand .crest { position: relative; z-index: 2; width: 62px; height: 62px; }
.ribbon {
  position: relative; overflow: hidden; margin-left: -22px; padding: 7px 26px 10px 32px;
  background: linear-gradient(180deg, #ff86aa 0%, var(--rib-1) 18%, var(--rib-2) 55%, var(--rib-3) 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.4), inset 0 -5px 0 rgba(120,0,40,.3);
}
.ribbon::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: glint 9s ease-in-out infinite; }
.ribbon-text { --o: #6b1a00; --ow: 2px; display: block; margin: 0; font-family: var(--font-fun); font-weight: 400; font-size: 26px; line-height: 1; letter-spacing: .6px; white-space: nowrap;
  color: #ffe65a; }
.brand .stars { position: absolute; left: 62px; right: 14px; bottom: -10px; z-index: 3; }
.brand .stars i { width: 15px; height: 15px; }

/* Flikar: fyrkantiga ikonknappar som i lobbyn, med etikett under */
.tabs { display: flex; gap: 12px; justify-self: end; align-items: flex-start; }
.tab { position: relative; border: 0; background: none; padding: 0 0 12px; display: flex; flex-direction: column; align-items: center; }
.tab-face {
  position: relative; width: 62px; height: 58px; border-radius: 20px; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,.55), transparent 70%),
    linear-gradient(180deg, var(--sq-1) 0%, var(--sq-2) 55%, var(--sq-3) 100%);
  box-shadow:
    inset 0 0 0 3px var(--sq-rim-2),
    inset 0 4px 0 3px rgba(182,255,255,.55),
    inset 0 -6px 0 rgba(0,40,140,.3),
    0 0 0 2.5px var(--sq-edge),
    0 5px 0 2.5px #072c70,
    0 9px 14px rgba(3,20,70,.35);
  transition: transform .14s cubic-bezier(.3,1.6,.5,1), filter .15s;
}
.tab-face svg { width: 40px; height: 40px; filter: drop-shadow(0 3px 0 rgba(0,30,100,.35)); transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
.tab:active .tab-face { transform: translateY(3px) scale(.94); }
.tab-label {
  --o: var(--teal-edge); --ow: 1.4px;
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  font-family: var(--font-fun); font-size: 14.5px; letter-spacing: .4px; color: #fff; white-space: nowrap; line-height: 1;
  padding: 4px 11px 5px; border-radius: 999px;
  background: linear-gradient(180deg, var(--teal-1), var(--teal-2) 45%, var(--teal-3));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), 0 0 0 2px var(--teal-edge), 0 2px 0 2px #08324a;
}
.tab.is-active .tab-face {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,.6), transparent 70%),
    linear-gradient(180deg, #ffe680 0%, #ffc61a 55%, #f09a0a 100%);
  box-shadow:
    inset 0 0 0 3px #fff2a0,
    inset 0 4px 0 3px rgba(255,255,255,.5),
    inset 0 -6px 0 rgba(150,60,0,.3),
    0 0 0 2.5px var(--gold-edge),
    0 5px 0 2.5px var(--gold-deep),
    0 0 18px 4px rgba(255,220,90,.45),
    0 9px 14px rgba(3,20,70,.35);
}
.tab.is-active .tab-face svg { transform: scale(1.08); }
.tab.is-active .tab-label {
  --o: var(--gold-edge);
  background: linear-gradient(180deg, var(--gold-hi), #ffe27a 40%, #f5a90c);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 0 0 2px var(--gold-edge), 0 2px 0 2px var(--gold-deep);
}
.tab-dot { /* röd "!" som i lobbyn */
  --o: var(--red-edge); --ow: 1.3px;
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-fun); font-size: 17px; color: #fff; line-height: 1;
  background: radial-gradient(circle at 40% 30%, #ff9ab0, var(--red-2) 50%, var(--red-3));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 0 0 2.5px #fff, 0 0 0 4.5px var(--red-edge);
  animation: nudge 3.5s ease-in-out infinite;
}
@keyframes nudge { 0%, 80%, 100% { transform: scale(1) rotate(0); } 85% { transform: scale(1.2) rotate(-12deg); } 90% { transform: scale(1.15) rotate(10deg); } 95% { transform: scale(1.1) rotate(-4deg); } }

.menu {
  position: absolute; right: 4px; top: 66px; z-index: 30; min-width: 250px; padding: 8px;
  background: #fff; border-radius: 20px;
  box-shadow: 0 0 0 3px var(--gold-2), 0 0 0 5.5px var(--gold-edge), 0 14px 30px rgba(4,16,54,.45);
  animation: pop .18s cubic-bezier(.3,1.5,.5,1);
}
.menu-head { font-size: 14px; color: var(--muted); padding: 6px 10px 8px; border-bottom: 2px solid #e6eefb; margin-bottom: 4px; }
.menu-head strong { color: var(--ink); font-weight: 600; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 12px; font-weight: 600; font-size: 16px; color: var(--ink); }
.menu button:hover { background: #eaf3ff; }

/* ---------- layout ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 24px; }
.panel { --r-out: 34px; min-height: 0; display: flex; flex-direction: column; padding: 9px; }
.view { display: none; }
.view.is-active { display: flex; animation: viewIn .25s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.sidebar { display: none; }

@media (min-width: 960px) {
  .hud { grid-template-columns: auto auto 1fr auto auto; grid-template-areas: "me brand . tabs gear"; padding-bottom: 18px; }
  .hud-pill { display: none; }
  .layout { grid-template-columns: 1fr 290px; }
  .sidebar { display: flex; grid-column: 2; grid-row: 1; }
  .view { grid-column: 1; grid-row: 1; }
  .ribbon-text { font-size: 31px; }
  .brand .crest { width: 74px; height: 74px; }
  .brand .stars { left: 74px; }
  .tab-face { width: 70px; height: 64px; }
  .tab-face svg { width: 44px; height: 44px; }
  .menu { top: 80px; }
  .app { padding-top: 14px; }
}

/* Chatytan: spelets blå fjällmönster */
.frame {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 0 0 2.5px var(--gold-edge), inset 0 6px 16px rgba(5,20,70,.5);
  background-color: var(--chat-bg);
  background-image:
    radial-gradient(circle at 50% 112%, var(--chat-scale) 0 44%, transparent 45.5%),
    radial-gradient(circle at 50% 112%, rgba(255,255,255,.06) 0 50%, transparent 51.5%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.08));
  background-size: 44px 26px, 44px 26px, 100% 100%;
}
.frame-paper {
  background: linear-gradient(180deg, #fffdf4, #fdf3d6);
  box-shadow: 0 0 0 2.5px var(--gold-edge), inset 0 4px 10px rgba(120,70,10,.15);
  overflow-y: auto;
}
.frame-blue {
  background: linear-gradient(180deg, #6cc4ff 0%, var(--info-1) 14%, var(--info-2) 55%, var(--info-4) 100%);
  box-shadow: 0 0 0 2.5px var(--gold-edge), inset 0 4px 0 rgba(255,255,255,.3), inset 0 -8px 16px rgba(10,40,120,.35);
  padding: 16px 14px; overflow-y: auto;
}
.panel-title { --o: #4b1f7a; --ow: 2.2px; font-family: var(--font-fun); font-weight: 400; font-size: 27px; margin: 0 0 14px; letter-spacing: .6px; color: #fff; line-height: 1.1; text-align: center; }

/* =================================================================
   Chatt
   ================================================================= */
.scroller {
  flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none;
  padding: 10px 16px 20px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent;
}
.scroller::-webkit-scrollbar { width: 8px; }
.scroller::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 8px; }

.history-top { min-height: 38px; display: grid; place-items: center; }
.history-start, .day span {
  --o: #06243f; --ow: 1.2px;
  font-family: var(--font-fun); font-size: 14.5px; letter-spacing: .4px; color: #fff;
  background: linear-gradient(180deg, rgba(10,50,95,.85), rgba(16,70,120,.8));
  padding: 5px 15px 6px; border-radius: 999px;
  box-shadow: inset 0 2px 3px rgba(0,0,0,.3), 0 1px 0 1.5px rgba(255,255,255,.12);
  text-shadow: 0 1.5px 0 #06243f;
}
.history-start { margin: 4px 0 8px; }
.loader { display: flex; gap: 8px; padding: 8px; }
.loader i { width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 18%, rgba(255,255,255,.25) 40%, rgba(255,255,255,.7) 70%, transparent 74%);
  animation: blip 1s ease-in-out infinite; }
.loader i:nth-child(2) { animation-delay: .15s; } .loader i:nth-child(3) { animation-delay: .3s; }
@keyframes blip { 0%,100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-8px); opacity: 1; } }

.day { display: flex; justify-content: center; margin: 20px 0 4px; }

/* --- meddelande --- */
.msg { display: flex; align-items: flex-start; gap: 16px; margin-top: 18px; }
.msg.cont { margin-top: 7px; }
.msg .avatar { margin: 9px 8px 0; }
.msg.cont .avatar { visibility: hidden; height: 0; margin-top: 0; }
.msg.cont .who { display: none; }
.msg.cont .bubble::before { display: none; }
.msg.me { flex-direction: row-reverse; }

.bubble {
  position: relative; min-width: 120px; max-width: min(640px, calc(100% - 90px));
  padding: 11px 20px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #fafeff 70%, #eef6ff 100%);
  border-radius: 26px;
  box-shadow: inset 0 -3px 0 rgba(150,180,220,.35), 0 5px 0 rgba(10,30,90,.3), 0 10px 18px rgba(10,30,90,.2);
}
.bubble::before { /* svans */
  content: ""; position: absolute; top: 22px; left: -15px; width: 18px; height: 24px;
  background: #fdfeff; clip-path: polygon(100% 0, 0 46%, 100% 100%);
}
.msg.me .bubble {
  background: linear-gradient(180deg, #e9fcd9 0%, #d6f6bf 70%, #c8eeac 100%);
  box-shadow: inset 0 0 0 2px #b2e28d, inset 0 -3px 0 rgba(90,160,50,.25), 0 5px 0 rgba(10,30,90,.3), 0 10px 18px rgba(10,30,90,.2);
}
.msg.me .bubble::before { left: auto; right: -15px; clip-path: polygon(0 0, 100% 46%, 0 100%); background: #def8ca; }
.msg.mention .bubble {
  background: linear-gradient(180deg, #fffcea 0%, #fff4c4 100%);
  box-shadow: inset 0 0 0 3px #ffc61a, inset 0 0 0 5px #fff6c8, 0 5px 0 rgba(10,30,90,.3), 0 0 22px rgba(255,210,60,.45);
}
.msg.mention .bubble::before { background: #fffae0; }

.who { --o: var(--c-dk, #102f7a); --ow: 1.6px; font-family: var(--font-fun); font-size: 22px; letter-spacing: .6px; line-height: 1.15; color: var(--c-1, #4eadf7); margin: 0 0 5px; }
.who::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: 2px;
  background: linear-gradient(180deg, #fff, var(--c-hi, #fff)); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: .9; }
.text { font-family: var(--font-ui); font-weight: 600; font-size: 18px; line-height: 1.36; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.text a { color: var(--info-3); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.text .jumbo { font-size: 46px; line-height: 1.15; font-family: var(--emoji); display: inline-block; animation: jumbo .5s cubic-bezier(.3,1.8,.5,1); }
@keyframes jumbo { from { transform: scale(.3) rotate(-15deg); } }
.mention-tag { color: var(--info-3); background: #d9ebff; padding: 0 7px; border-radius: 9px; box-shadow: inset 0 -2px 0 rgba(47,104,230,.2); }
.mention-tag.me { color: #8a3a00; background: linear-gradient(180deg, #fff2a0, #ffd23a); box-shadow: inset 0 -2px 0 rgba(170,90,0,.25); }

.time { --o: #fff; --ow: 0px; display: block; text-align: right; margin-top: 3px; font-family: var(--font-fun); font-size: 15px; letter-spacing: .3px; color: var(--time); white-space: nowrap; user-select: none; text-shadow: none; }
.msg.me .time { color: #5f9a33; }
.msg.mention .time { color: #c08410; }

.msg.fresh { animation: msgIn .4s cubic-bezier(.2,.9,.3,1.35) both; }
.msg.fresh .avatar { animation: avIn .45s cubic-bezier(.3,1.7,.5,1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes avIn { from { transform: scale(.4); } }

.empty-chat { margin: 30px auto; max-width: 300px; text-align: center; color: #fff; font-size: 17px; text-shadow: 0 1.5px 0 rgba(6,36,63,.6); }
.empty-chat img { width: 200px; height: 200px; object-fit: cover; border-radius: 30px; display: block; margin: 0 auto 14px;
  box-shadow: 0 0 0 3px #fffbe0, 0 0 0 7px var(--gold-2), 0 0 0 9px var(--gold-edge), 0 6px 0 9px var(--gold-deep); }
.empty-chat b { --o: #4b1f7a; --ow: 2px; font-family: var(--font-fun); font-weight: 400; font-size: 27px; display: block; margin-bottom: 6px; }

.new-pill { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 5; animation: pop .25s cubic-bezier(.3,1.6,.5,1); }
.new-pill:active { transform: translateX(-50%) translateY(4px); }

/* ---------- skrivfält ---------- */
.composer {
  position: relative; display: flex; align-items: flex-end; gap: 14px;
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, #2a5bb8, #1d4596);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.15), inset 0 1px 0 rgba(255,255,255,.2), 0 -4px 12px rgba(5,20,70,.3);
}
.input-wrap {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-end;
  background: linear-gradient(180deg, #e8f2ff, #fff 30%); border-radius: 26px;
  box-shadow: inset 0 3px 5px rgba(10,30,90,.22), 0 0 0 3px var(--info-edge), 0 2px 0 3px rgba(255,255,255,.18);
}
.input-wrap:focus-within { box-shadow: inset 0 3px 5px rgba(10,30,90,.16), 0 0 0 3px var(--gold-2), 0 0 0 5.5px var(--gold-edge); }
.icon-btn { flex: none; width: 50px; height: 50px; border: 0; background: none; padding: 9px; transition: transform .15s cubic-bezier(.3,1.6,.5,1); }
.icon-btn svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(120,60,0,.3)); }
.icon-btn:hover { transform: rotate(-10deg) scale(1.08); }
.icon-btn:active { transform: scale(.85); }
#input {
  flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent;
  padding: 13px 16px 13px 0; font-family: var(--font-ui); font-weight: 600; font-size: 17px; line-height: 1.4; max-height: 38vh; color: var(--ink);
}
#input::placeholder { color: #98a6c6; font-weight: 500; }
.counter { position: absolute; right: 14px; top: -26px; font-size: 13px; font-weight: 600; color: #fff; background: rgba(10,50,95,.9); padding: 2px 10px; border-radius: 999px; }
.counter.warn { background: var(--red-2); }

/* Skicka – lobbyns "spela"-knapp: marinblå pil med guldkant */
.send-btn {
  position: relative; overflow: hidden; flex: none; width: 62px; height: 54px; border: 0; padding: 0 0 0 4px; display: grid; place-items: center;
  border-radius: 20px 50% 50% 20px / 20px 50% 50% 20px;
  background:
    radial-gradient(ellipse 80% 45% at 40% 10%, rgba(255,255,255,.5), transparent 70%),
    linear-gradient(180deg, #58a6ff 0%, #2a76db 45%, #1f68c0 70%, #173f9a 100%);
  box-shadow:
    inset 0 0 0 2px #7cc0ff,
    0 0 0 3px #ffd84a,
    0 0 0 5.5px #fdb701,
    0 0 0 7.5px var(--gold-edge),
    0 5px 0 7.5px var(--gold-deep);
  margin: 0 8px 7px 0;
  transition: transform .12s cubic-bezier(.3,1.6,.5,1);
}
.send-btn::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: glint 7s ease-in-out infinite; }
.send-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(0,20,80,.4)); }
.send-btn:hover { transform: scale(1.05); }
.send-btn:active { transform: translateY(3px) scale(.94); }
.send-btn:disabled { filter: grayscale(.4); }

.puff { position: fixed; z-index: 50; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 14%, rgba(255,255,255,.25) 35%, rgba(255,255,255,.55) 68%, transparent 72%);
  animation: puff .8s ease-out forwards; }
@keyframes puff { to { transform: translate(var(--dx), -90px) scale(.5); opacity: 0; } }

/* ---------- popups: @-förslag, smileys ---------- */
.suggest, .emoji-pop {
  position: absolute; left: 14px; bottom: calc(100% + 12px); z-index: 20; background: #fff; border-radius: 22px;
  box-shadow: 0 0 0 3px var(--gold-2), 0 0 0 5.5px var(--gold-edge), 0 5px 0 5.5px var(--gold-deep), 0 16px 30px rgba(4,16,54,.45);
  animation: pop .18s cubic-bezier(.3,1.5,.5,1);
}
.suggest { right: 90px; padding: 6px; max-height: 260px; overflow: auto; }
.suggest button { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 14px; text-align: left; font-weight: 600; font-size: 17px; color: var(--ink); }
.suggest button.is-active, .suggest button:hover { background: #e3f0ff; }
.suggest .avatar.xs { margin: 4px; }
.suggest .s-sub { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.suggest .s-all { width: 34px; height: 34px; margin: 4px; border-radius: 10px; display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(180deg, #fff2a0, #ffc61a); box-shadow: 0 0 0 2px var(--gold-edge), 0 3px 0 2px var(--gold-deep); }

.emoji-pop { width: min(370px, calc(100vw - 54px)); overflow: hidden; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: linear-gradient(180deg, var(--info-1), var(--info-3)); }
.emoji-tabs button { flex: 1; border: 0; background: none; font-size: 21px; padding: 7px 0 9px; border-radius: 14px 14px 0 0; font-family: var(--emoji); opacity: .7; }
.emoji-tabs button.is-active { opacity: 1; background: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; max-height: 236px; overflow-y: auto; }
.emoji-grid button { border: 0; background: none; font-size: 26px; line-height: 1; padding: 6px 0; border-radius: 12px; font-family: var(--emoji); transition: transform .12s cubic-bezier(.3,1.6,.5,1); }
.emoji-grid button:hover { background: #eaf3ff; transform: scale(1.25); }
.emoji-empty { grid-column: 1 / -1; color: var(--muted); font-size: 15px; padding: 12px; text-align: center; }

@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }

/* =================================================================
   Regler
   ================================================================= */
.rules-banner { position: relative; height: 170px; overflow: hidden; flex: none;
  box-shadow: 0 3px 0 var(--gold-edge), 0 6px 12px rgba(120,70,10,.2); }
.rules-banner img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; display: block; }
.rules-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,60,140,.0) 30%, rgba(10,40,110,.55)); }
.rules-banner .panel-title { position: absolute; left: 18px; bottom: 12px; z-index: 2; margin: 0; text-align: left; }
.rules-banner .btn { position: absolute; right: 16px; bottom: 16px; z-index: 2; }
.rules-body { font-size: 17.5px; line-height: 1.55; max-width: 720px; padding: 20px 22px 0; }
.rules-body h3 { --o: #4b1f7a; --ow: 1.8px; font-family: var(--font-fun); font-weight: 400; color: #fff; font-size: 26px; margin: 18px 0 10px; letter-spacing: .5px; line-height: 1.15; }
.rules-body h3:first-child { margin-top: 0; }
.rules-body h4 { font-family: var(--font-fun); font-weight: 400; font-size: 21px; color: var(--info-3); margin: 16px 0 6px; letter-spacing: .4px; }
.rules-body p { margin: 0 0 10px; }
.rules-body strong { font-weight: 600; color: #1d2f55; }
.rules-body ul, .rules-body ol { margin: 0 0 12px; padding: 0; list-style: none; }
.rules-body ol { counter-reset: n; }
.rules-body li { position: relative; padding: 10px 14px 10px 50px; margin: 8px 0; background: #fff; border-radius: 16px;
  box-shadow: 0 0 0 2px #f1dfae, 0 3px 0 2px #e6c886; }
.rules-body ul li::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 24px; height: 24px; transform: translateY(-50%);
  background: linear-gradient(180deg, #ffd0f2, #e35bd6 45%, #9b27b0);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  filter: drop-shadow(0 2px 0 #5c1470);
}
.rules-body ol li { counter-increment: n; }
.rules-body ol li::before {
  --o: var(--gold-edge);
  content: counter(n); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-fun); font-size: 16px; color: #fff;
  text-shadow: -1px -1px 0 var(--o), 1px -1px 0 var(--o), -1px 1px 0 var(--o), 1px 1px 0 var(--o), 0 2px 0 var(--o);
  background: linear-gradient(180deg, #fff2a0, #ffc61a 50%, #f09a0a);
  box-shadow: 0 0 0 2px var(--gold-edge), 0 2px 0 2px var(--gold-deep);
}
.rules-body a { color: var(--info-3); font-weight: 600; }
.rules-empty { color: var(--ink-2); background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 0 0 2px #f1dfae, 0 3px 0 2px #e6c886; }
.rules-meta { padding: 16px 22px 22px; font-size: 14px; font-weight: 600; color: #a08a5a; }
.rules-meta b { color: #7a6532; font-weight: 600; }
.rules-edit { padding: 18px 20px 22px; }
.rules-edit textarea {
  width: 100%; min-height: 44vh; resize: vertical; border-radius: 20px; border: 0; padding: 16px; background: #fff; outline: 0;
  font-family: var(--font-ui); font-weight: 500; font-size: 17px; line-height: 1.5; color: var(--ink);
  box-shadow: inset 0 3px 5px rgba(120,70,10,.15), 0 0 0 3px #e6c886;
}
.rules-edit textarea:focus { box-shadow: inset 0 3px 5px rgba(120,70,10,.1), 0 0 0 3px var(--gold-2), 0 0 0 5.5px var(--gold-edge); }
.hint { font-size: 14px; color: #8a7444; margin: 12px 2px 16px; }
.hint code { background: #f6e7bd; padding: 0 6px; border-radius: 6px; }
.row-end { display: flex; justify-content: flex-end; gap: 16px; flex-wrap: wrap; }

/* =================================================================
   Medlemmar – vita rader på blå panel, som spelets listor
   ================================================================= */
.member-group { --o: var(--info-edge); --ow: 1.3px; font-family: var(--font-fun); font-size: 16px; letter-spacing: .6px; color: #fff; margin: 16px 6px 8px; }
.member-group:first-child { margin-top: 0; }
.member {
  display: flex; align-items: center; gap: 14px; width: 100%; border: 0; padding: 8px 12px 8px 8px; margin: 0 0 9px; text-align: left;
  background: linear-gradient(180deg, #fff, #eef6ff); border-radius: 16px;
  box-shadow: inset 0 -3px 0 rgba(120,160,220,.3), 0 0 0 2px var(--info-edge), 0 4px 0 2px var(--info-deep);
  transition: transform .12s cubic-bezier(.3,1.6,.5,1);
}
.member:active { transform: translateY(3px); }
.member .avatar.xs { margin: 5px; }
.member .m-name { font-weight: 600; font-size: 17px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .m-sub { margin-left: auto; font-family: var(--font-fun); font-size: 13.5px; letter-spacing: .3px; color: var(--muted); white-space: nowrap; }
.member .m-on { margin-left: auto; width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff 0 15%, var(--green-1) 24%, var(--green-4)); box-shadow: 0 0 0 2px var(--green-edge), 0 0 10px rgba(135,215,68,.8); }
.member.off { background: linear-gradient(180deg, #e7eefa, #d5e1f3); }
.member.off .avatar { filter: saturate(.25) brightness(1.05); }
.member.off .m-name { color: var(--ink-2); }
.member .you { font-size: 13px; color: var(--muted); }

.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(4,20,60,.6); animation: fade .2s; backdrop-filter: blur(2px); }
.sheet-card { --r-out: 34px; position: relative; width: 100%; max-width: 520px; padding: 9px 9px 0; animation: slideUp .3s cubic-bezier(.2,.9,.3,1.15); }
.sheet-card::before { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sheet-card .frame-blue { border-radius: 26px 26px 0 0; max-height: 76vh; padding-bottom: calc(18px + var(--safe-b)); }
.sheet-card .btn { width: 100%; margin-top: 8px; }
.sheet-grip { width: 50px; height: 6px; border-radius: 9px; background: rgba(255,255,255,.6); margin: -4px auto 12px; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

/* =================================================================
   Namn-dialog
   ================================================================= */
.modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 24px 18px; overflow: auto; }
.modal .popup { animation: popIn .45s cubic-bezier(.2,.9,.3,1.35); }
@keyframes popIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.close-x {
  position: absolute; top: -12px; right: -12px; z-index: 3; width: 50px; height: 50px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 45% 30%, #ff9ab0, var(--red-2) 50%, var(--red-3));
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), inset 0 -4px 0 rgba(0,0,0,.15), 0 0 0 3px #fff8e0, 0 0 0 5.5px var(--red-edge), 0 4px 0 5.5px #45081a;
  transition: transform .12s cubic-bezier(.3,1.6,.5,1);
}
.close-x svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 5; stroke-linecap: round; fill: none; filter: drop-shadow(0 2px 0 var(--red-edge)); }
.close-x:active { transform: scale(.88); }
.modal #nameHero[hidden] + .crest-lg { margin-top: 18px; }

#nameInput {
  width: 100%; padding: 14px 16px; border-radius: 22px; border: 0; outline: 0; margin: 4px 0 18px;
  font-family: var(--font-ui); font-weight: 600; font-size: 20px; text-align: center; color: var(--ink);
  background: linear-gradient(180deg, #e8f2ff, #fff 30%);
  box-shadow: inset 0 3px 6px rgba(10,30,90,.25), 0 0 0 3px var(--info-edge);
}
#nameInput:focus { box-shadow: inset 0 3px 6px rgba(10,30,90,.18), 0 0 0 3px var(--gold-2), 0 0 0 5.5px var(--gold-edge); }
.popup .row-end { justify-content: center; }
.form-error { color: #fff; background: var(--red-2); border-radius: 12px; padding: 6px 10px; font-weight: 600; font-size: 15px; margin: -6px 0 16px !important; box-shadow: 0 0 0 2px var(--red-edge); }
.known { margin-top: 22px; padding-top: 18px; border-top: 2px dashed rgba(255,255,255,.45); }
.known-label { font-size: 16px !important; margin-bottom: 12px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-height: 200px; overflow: auto; padding: 8px 4px; }
.chip {
  border: 0; border-radius: 999px; padding: 5px 16px 5px 5px; display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, #fff, #eaf3ff); color: var(--ink); font-weight: 600; font-size: 16px;
  box-shadow: 0 0 0 2px var(--info-edge), 0 4px 0 2px var(--info-deep);
  transition: transform .1s cubic-bezier(.3,1.6,.5,1), box-shadow .1s;
}
.chip .avatar.xs { width: 28px; height: 28px; font-size: 15px; margin: 4px; }
.chip:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--info-edge), 0 1px 0 2px var(--info-deep); }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: linear-gradient(180deg, rgba(10,50,95,.96), rgba(16,70,120,.96)); color: #fff; font-weight: 600; font-size: 16px; padding: 11px 22px; border-radius: 999px;
  box-shadow: 0 0 0 2.5px var(--gold-2), 0 0 0 4.5px var(--gold-edge), 0 10px 24px rgba(0,0,0,.35);
  animation: pop .25s cubic-bezier(.3,1.6,.5,1); max-width: calc(100vw - 32px); text-align: center;
}

/* =================================================================
   Mobil
   ================================================================= */
@media (max-width: 600px) {
  .app { padding: 8px 10px calc(10px + var(--safe-b)); }
  .hud { gap: 6px 8px; padding-bottom: 12px; }
  .me-btn .avatar { width: 42px; height: 42px; font-size: 21px; margin: 8px 6px; }
  .hud-pill { height: 32px; padding: 0 14px 0 30px; }
  .hud-icon { width: 42px; height: 42px; left: -16px; }
  .hud-val { font-size: 17px; }
  .gear-btn { width: 44px; height: 44px; }
  .brand .crest { width: 52px; height: 52px; }
  .ribbon { margin-left: -18px; padding: 6px 20px 9px 26px; }
  .ribbon-text { font-size: 21px; }
  .brand .stars { left: 52px; bottom: -8px; }
  .brand .stars i { width: 13px; height: 13px; }
  .tabs { gap: 10px; }
  .tab-face { width: 54px; height: 50px; border-radius: 17px; }
  .tab-face svg { width: 34px; height: 34px; }
  .tab-label { font-size: 13px; padding: 3px 9px 4px; }
  .menu { top: 58px; }
  .panel { --r-out: 28px; padding: 7px; }
  .frame { border-radius: 22px; }
  .scroller { padding: 8px 10px 18px; }
  .msg { gap: 12px; margin-top: 16px; }
  .msg .avatar { width: 42px; height: 42px; font-size: 21px; border-radius: 12px; margin: 9px 7px 0; }
  .bubble { padding: 9px 15px 7px; border-radius: 22px; max-width: calc(100% - 68px); min-width: 96px; }
  .bubble::before { top: 16px; }
  .who { font-size: 19.5px; }
  .text { font-size: 16.5px; }
  .time { font-size: 13.5px; }
  .composer { padding: 10px 10px 12px; gap: 12px; }
  .send-btn { width: 54px; height: 48px; margin: 0 7px 7px 0; }
  .send-btn svg { width: 26px; height: 26px; }
  .icon-btn { width: 46px; height: 46px; }
  .rules-banner { height: 140px; }
  .rules-banner .panel-title { font-size: 23px; }
  .rules-body { padding: 16px 14px 0; font-size: 16.5px; }
  .rules-meta { padding: 14px 14px 18px; }
  .rules-edit { padding: 14px; }
  .panel-title { font-size: 24px; }
  .popup-hero { height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sea span, .caustics { display: none; }
}
