:root {
  --cream: #f4f0e4;
  --cream-2: #efe9da;
  --green: #2f6b4d;
  --green-d: #265a41;
  --green-felt: #356b51;
  --green-felt-d: #2c5d46;
  --ink: #25342c;
  --muted: #7c8a80;
  --card: #fbf7ee;
  --red: #b5392f;
  --black: #20211f;
  --line: #e2dccc;
  --shadow: 0 8px 24px rgba(40,50,40,.10);
  --r-card: 9px;
  --cardScale: 1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--cream); color: var(--ink);
  display: flex; justify-content: center; align-items: stretch;
}
#app {
  width: 100%; max-width: 460px; position: relative;
  /* bound the app to the real viewport height so each screen can scroll inside
     it instead of overflowing off-screen (iPhone Safari chrome eats space). */
  height: 100vh; height: 100dvh; /* vh fallback for older Safari (<15.4) */
  background: var(--cream); display: flex; flex-direction: column; overflow: hidden;
}
.screen { flex: 1; min-height: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* generic */
button { font-family: inherit; cursor: pointer; border: none; }
.btn-primary {
  display: flex; align-items: center; gap: 14px; justify-content: center;
  background: var(--green); color: #fff; font-size: 21px; font-weight: 500;
  padding: 19px 24px; border-radius: 30px; box-shadow: var(--shadow); width: 100%;
}
.btn-primary .ti { font-size: 24px; }
.btn-primary:active { transform: scale(.985); }
.pill { background: var(--green); color: #fff; border-radius: 30px; padding: 18px 22px; font-size: 20px; font-weight: 500; width: 100%; box-shadow: var(--shadow); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px; padding-top: calc(14px + env(safe-area-inset-top)); }
.topbar .ti { font-size: 26px; color: var(--ink); }
.title-c { text-align: center; font-size: 19px; font-weight: 500; flex: 1; }
.sub-c { text-align: center; color: var(--muted); font-size: 13px; margin-top: 2px; }
/* icon buttons get a 48px touch target (was a 36px tap zone — too small for older fingers) */
.ghost-ic { background: none; padding: 10px; display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; }
#bid-hint, #play-hint { position: relative; }
.hint-badge { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--red); color: #fff; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 19px;
  text-align: center; box-shadow: 0 0 0 2px var(--cream); }
.table-top .hint-badge { box-shadow: 0 0 0 2px var(--green); }
/* slow glowing ring that pulses outward, so beginners notice there's a tip waiting */
.hint-badge::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  animation: hintGlow 2.4s ease-out infinite; }
@keyframes hintGlow {
  0% { box-shadow: 0 0 0 0 rgba(181,57,47,.55); }
  70% { box-shadow: 0 0 0 10px rgba(181,57,47,0); }
  100% { box-shadow: 0 0 0 0 rgba(181,57,47,0); }
}
@media (prefers-reduced-motion: reduce) { .hint-badge::after { animation: none; } }
/* one-time coachmark bubble that points up to the hint lamp */
.lamp-coach { position: absolute; z-index: 40; max-width: 190px; background: var(--ink); color: #fff;
  padding: 9px 13px; border-radius: 12px; font-size: 14px; font-weight: 500; line-height: 1.35;
  box-shadow: var(--shadow); animation: jbFadeIn .3s ease both; }
.lamp-coach::before { content: ''; position: absolute; top: -6px; left: 18px;
  border: 6px solid transparent; border-top: 0; border-bottom-color: var(--ink); }

/* home */
.home { justify-content: safe center; align-items: center; gap: 14px; text-align: center;
  min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 28px calc(18px + env(safe-area-inset-bottom)); }
.logo { font-size: 54px; font-weight: 700; color: var(--green); letter-spacing: 1px; line-height: 1; }
.logo .suits { font-size: 22px; letter-spacing: 2px; display: block; margin-top: 6px; }
.logo .s-red { color: var(--red); } .logo .s-blk { color: var(--green-d); }
.home h1 { font-size: 40px; font-weight: 700; color: var(--green); margin: 8px 0 2px; }
.home .tag { color: var(--muted); font-size: 16px; margin-bottom: 22px; }
.menu { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 320px; }
.diff-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.diff-pick .diff-label { color: var(--muted); font-size: 14px; font-weight: 500; flex: none; }
.diff-seg { display: flex; gap: 6px; flex: 1; background: var(--cream-2); border-radius: 22px; padding: 4px; }
.diff-seg button { flex: 1; background: none; color: var(--ink); border-radius: 18px; padding: 8px 0; font-size: 14px; font-weight: 500; transition: background .12s; }
.diff-seg button.on { background: var(--green); color: #fff; }
.home .blurb { color: var(--muted); font-size: 14px; margin-top: 22px; max-width: 260px; }
.home-logo { width: auto; max-width: 78%; max-height: 26vh; height: auto; margin-bottom: 6px; }
.home .made { color: var(--muted); font-size: 13px; margin-top: 10px; }
.home .made .s-red { color: var(--red); }
.ver-badge { background: var(--cream-2); color: var(--muted); font-size: 12px; font-weight: 500;
  border-radius: 20px; padding: 5px 12px; margin-top: 16px; letter-spacing: .3px; }
.ver-badge:active { background: #e4eee5; }

/* home entrance animations — logo bounces in, then levels, then menu buttons.
   The JS removes these classes on animationend so :active transforms still work. */
@keyframes jbBounceIn {
  0% { opacity: 0; transform: translateY(22px) scale(.92); }
  60% { opacity: 1; transform: translateY(-5px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes jbLogoIn {
  0% { opacity: 0; transform: translateY(-26px) scale(.82); }
  55% { opacity: 1; transform: translateY(7px) scale(1.04); }
  78% { transform: translateY(-3px) scale(.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes jbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-in { opacity: 0; animation: jbBounceIn .5s cubic-bezier(.2,.7,.3,1.35) both; }
.anim-logo { opacity: 0; animation: jbLogoIn .62s cubic-bezier(.2,.7,.3,1.3) both; }
.anim-fade { opacity: 0; animation: jbFadeIn .4s ease both; }
@media (prefers-reduced-motion: reduce) {
  .anim-in, .anim-logo, .anim-fade { animation: none !important; opacity: 1 !important; }
}

/* what's new panel */
.wn-body { flex: 1; overflow-y: auto; padding: 8px 22px 16px; }
.wn-figure { text-align: center; margin: 6px 0 4px; }
.wn-figure img { height: 96px; width: auto; }
.wn-release { background: var(--cream-2); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; text-align: start; }
.wn-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.wn-ver { color: var(--green); font-weight: 700; font-size: 17px; }
.wn-date { color: var(--muted); font-size: 12px; }
.wn-list { margin: 0; padding-inline-start: 20px; }
.wn-list li { font-size: 15px; line-height: 1.5; margin-bottom: 5px; }
.wn-list li::marker { color: var(--green); }

/* list cards (choose game / settings) */
.list { padding: 8px 16px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.list-card { background: var(--cream-2); border-radius: 16px; padding: 18px 18px; display: flex; align-items: center; gap: 14px; }
.list-card.sel { background: #e4eee5; outline: 2px solid var(--green); }
.list-card .ti { font-size: 28px; color: var(--green); }
.list-card .lc-main { font-weight: 500; font-size: 18px; }
.list-card .lc-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.row { background: var(--cream-2); border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; font-size: 17px; min-height: 56px; }
.row .val { color: var(--muted); display: flex; align-items: center; gap: 6px; }
/* toggle */
.toggle { width: 52px; height: 31px; border-radius: 20px; background: #cfc9b8; position: relative; transition: background .15s; flex: none; }
.toggle.on { background: var(--green); }
.toggle::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 25px; height: 25px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.toggle.on::after { inset-inline-start: 24px; }

/* table */
.table-wrap { flex: 1; display: flex; flex-direction: column; background: var(--cream); }
.table-top { background: var(--green); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 12px; padding-top: calc(12px + env(safe-area-inset-top)); }
.table-top .ti { font-size: 22px; color: #fff; }
.tt-mid { text-align: center; flex: 1; } .tt-mid .c1 { font-size: 16px; font-weight: 500; } .tt-mid .c2 { font-size: 12px; opacity: .85; }
.badge { background: rgba(255,255,255,.18); border-radius: 20px; padding: 4px 12px; font-size: 14px; font-weight: 500; }
.scoreboard { display: flex; gap: 8px; align-items: stretch; }
.score-chip { position: relative; background: rgba(255,255,255,.14); border-radius: 14px; padding: 4px 14px; min-width: 64px;
  display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.score-chip.us { background: rgba(255,211,77,.26); }
.score-chip .sc-label { font-size: 12px; opacity: .9; }
.score-chip .sc-num { font-size: 22px; font-weight: 700; }
.score-chip .sc-need { font-size: 13px; font-weight: 500; opacity: .8; }
.score-pop { position: absolute; z-index: 30; color: #fff; font-weight: 800; font-size: 26px;
  pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.5); animation: scorePop 950ms ease-out forwards; }
.score-pop.us { color: #ffd34d; }
@keyframes scorePop {
  0% { opacity: 0; transform: translate(-50%, -6px) scale(.5); }
  22% { opacity: 1; transform: translate(-50%, 8px) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, 46px) scale(1); }
}
.play-status { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--green-felt-d); color: #eaf3ec; padding: 11px 16px; font-size: 16px; }
.play-status .ps-contract b { color: #ffd34d; font-weight: 700; font-size: 18px; }
.play-status .ps-turn { background: rgba(255,255,255,.16); border-radius: 20px; padding: 5px 14px; font-weight: 500; white-space: nowrap; }
.play-status .ps-turn.me { background: #ffd34d; color: #1f3a2b; font-weight: 700; }
.felt { flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--green-felt); position: relative; display: grid;
  grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto 1fr auto;
  grid-template-areas: '. north .' 'west center east' '. south .'; padding: 8px; gap: 4px; }
.seatbox { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #eaf3ec; font-size: 12px; align-self: center; justify-self: center; }
.seatbox.north { grid-area: north; } .seatbox.south { grid-area: south; }
.seatbox.west { grid-area: west; } .seatbox.east { grid-area: east; }
/* dummy hand at the top spans the full width and hugs the label (no wasted green) */
.felt .dummy-top { grid-column: 1 / -1; grid-row: 1; align-self: start; justify-self: stretch; width: 100%; gap: 2px; }
.dummy-top .role { opacity: .85; }
.dummy-top .hand { min-height: 0; align-items: center; }
.dummy-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dummy-head .avatar { width: 34px; height: 34px; border-width: 2px; }
.avatar { width: 50px; height: 50px; border-radius: 50%; background: #d9e6db; display: flex; align-items: center; justify-content: center; font-size: 24px; border: 2px solid rgba(255,255,255,.6); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.turn { box-shadow: 0 0 0 3px #ffd34d; }
.seatbox.south .avatar { width: 62px; height: 62px; }
.seatbox .nm { font-weight: 500; } .seatbox .role { opacity: .8; font-size: 11px; }
.compass { grid-area: center; align-self: center; justify-self: center; color: #cfe2d4; text-align: center; font-size: 12px; }
.center-area { grid-area: center; position: relative; align-self: stretch; justify-self: stretch; }
.bidbubble { position: absolute; background: #fff; color: var(--ink); border-radius: 14px; padding: 3px 10px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); }
.s-red { color: var(--red); } .s-blk { color: var(--black); }

/* played trick cards positioned in center */
.trick { position: absolute; inset: 0; }
.pcard.tcard { position: absolute; margin: 0; width: calc(52px * var(--cardScale)); height: calc(74px * var(--cardScale)); }
.pcard.tcard .corner { font-size: calc(17px * var(--cardScale)); }
.pcard.tcard .pip { font-size: calc(18px * var(--cardScale)); }

/* hand (bottom) */
.hand-zone { background: var(--green-felt-d); padding: 12px 6px 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
/* bid screen: keep the green strip short (cards hug the top), and the cards
   overhang onto a soft-green "floor" below instead of bare white. */
#screen-bid .hand-zone { position: relative; z-index: 1; }
.bid-floor { flex: 1; background: #dde8dd; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(108px * var(--cardScale)); }
.dummy-zone { background: var(--green-felt); padding: 6px; }
.dummy-zone .hand { min-height: calc(70px * var(--cardScale)); }

/* card visual */
.pcard {
  width: calc(72px * var(--cardScale)); height: calc(104px * var(--cardScale));
  background: var(--card); border-radius: var(--r-card); box-shadow: 0 2px 5px rgba(0,0,0,.28);
  margin-inline-start: calc(-30px * var(--cardScale)); position: relative; flex: none;
  display: flex; align-items: flex-start; justify-content: flex-start; transition: transform .12s;
}
.pcard:first-child { margin-inline-start: 0; }
.pcard .corner { padding: 5px 0 0 6px; line-height: 1; font-weight: 700; font-size: calc(23px * var(--cardScale)); }
.pcard .pip { position: absolute; bottom: 6px; inset-inline-end: 7px; font-size: calc(25px * var(--cardScale)); }
.pcard.playable { cursor: pointer; }
.pcard.playable:active { transform: translateY(-10px); }
.pcard.hintglow { box-shadow: 0 0 0 3px #ffd34d, 0 2px 5px rgba(0,0,0,.28); transform: translateY(-12px); }
.pcard.dim { opacity: .45; }
.pcard.mini { width: calc(40px * var(--cardScale)); height: calc(58px * var(--cardScale)); margin-inline-start: calc(-22px * var(--cardScale)); }
.pcard.mini .corner { font-size: calc(15px * var(--cardScale)); padding: 4px 0 0 5px; }
.pcard.mini .pip { display: none; }
.cardback { background: repeating-linear-gradient(45deg, #2f6b4d, #2f6b4d 6px, #38795a 6px, #38795a 12px); }

/* held-fan layout for the player's hand */
.hand .pcard { transform-origin: bottom center; transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px)); }
.hand .pcard.playable:active { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 14px)); }
.hand .pcard.hintglow { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 16px)); }
.hand { overflow: visible; }

/* bidding box */
.bidbox-screen { background: var(--cream); }
/* two-step picker: pick a level (1-7), then a strain (suit / NT) */
.bidpicker { display: flex; flex-direction: column; gap: 8px; padding: 6px 16px; }
.bid-hint-line { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 2px; }
.bidrow { display: flex; gap: 7px; }
.pickbtn { flex: 1; border-radius: 14px; padding: 12px 0; min-height: 54px; background: var(--cream-2);
  color: var(--ink); font-size: 23px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.strain-row .pickbtn { font-size: 27px; }
.pickbtn:disabled { opacity: .28; }
.pickbtn:active:not(:disabled) { transform: scale(.95); }
.lvlbtn.sel { background: var(--green); color: #fff; box-shadow: var(--shadow); }
.bidactions { display: flex; gap: 10px; padding: 10px 16px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.bidactions button { flex: 1; border-radius: 14px; padding: 16px 0; font-size: 18px; font-weight: 600; min-height: 52px; }
.b-pass { background: var(--cream-2); color: var(--ink); }
.b-dbl { background: #c0392b; color: #fff; }
.b-rdbl { background: #1f3a63; color: #fff; }
.bidactions button:disabled { opacity: .3; }
/* auction so far — one clear horizontal scrolling row, never clipped */
.auction-strip { display: flex; gap: 8px; flex-wrap: nowrap; padding: 10px 16px; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; }
.acall { background: var(--cream-2); border-radius: 10px; padding: 6px 12px; min-width: 52px; flex: none;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.acall .who { color: var(--muted); font-weight: 500; font-size: 13px; }
.acall .bid { font-size: 22px; font-weight: 700; }
.acall .bid.word { font-size: 17px; font-weight: 600; color: var(--ink); }
.acall.you { background: #fff7e0; box-shadow: inset 0 0 0 1.5px #ffd34d; }
.acall.latest { box-shadow: inset 0 0 0 2px var(--green); }
.ac-table { border-collapse: collapse; margin: 4px auto 18px; font-size: 20px; }
.ac-table th { background: var(--green); color: #fff; font-weight: 500; font-size: 14px; padding: 8px 0; }
.ac-table th, .ac-table td { width: 70px; text-align: center; border: 1px solid var(--cream-2); padding: 10px 0; font-weight: 700; }
.ac-table td .ac-word { font-weight: 500; color: var(--muted); font-size: 16px; }
.ac-table td.ac-you { background: #fff7e0; }
.ac-table td.ac-final { background: #ffd34d; border-radius: 0; }
.ac-contract { font-size: 19px; margin-top: 4px; }
.ac-contract b { font-weight: 700; }

/* result + hint as overlay panels */
.panel { position: absolute; inset: 0; background: var(--cream); z-index: 20; display: none; flex-direction: column; }
.panel.active { display: flex; }
/* share panel opens by sliding up from the bottom and closes by sliding out to
   the right (toward the back arrow). */
@keyframes panelSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes panelSlideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
.panel.slide-in { animation: panelSlideUp .28s cubic-bezier(.2,.8,.25,1) both; }
.panel.slide-out { animation: panelSlideOutRight .26s cubic-bezier(.4,0,.7,.3) both; }
/* a whole screen sliding out to the right (e.g. bid screen → home) */
.screen.slide-out { animation: panelSlideOutRight .26s cubic-bezier(.4,0,.7,.3) both; z-index: 10; }
@media (prefers-reduced-motion: reduce) {
  .panel.slide-in, .panel.slide-out, .screen.slide-out { animation: none !important; }
}
.panel-body { position: relative; overflow: hidden; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 6px; }
.result-emoji { font-size: 56px; }
.result-figure { height: 150px; width: auto; max-width: 80%; object-fit: contain; }
.result-score { font-size: 40px; font-weight: 700; color: var(--green); }
.result-score.neg { color: var(--red); }
.rtable { width: 100%; max-width: 300px; margin-top: 14px; border-top: 1px solid var(--line); }
.rtable .rrow { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 16px; }
.rtable .rrow .lbl { color: var(--muted); }
.result-explain { max-width: 300px; margin: 14px auto 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* result celebration: confetti over the figure + a gleam sweeping the button */
.confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti { position: absolute; top: -18px; width: 9px; height: 14px; border-radius: 2px; will-change: transform; }
.pill.shine { position: relative; overflow: hidden; }
.pill.shine::after { content: ''; position: absolute; top: 0; bottom: 0; width: 45%; left: -70%;
  transform: skewX(-18deg); background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  animation: pillShine 2.6s ease-in-out infinite; }
@keyframes pillShine { 0% { left: -70%; } 55% { left: 140%; } 100% { left: 140%; } }
@media (prefers-reduced-motion: reduce) { .pill.shine::after { display: none; } }
.hint-icon { width: 92px; height: 92px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 44px; color: #e7b84a; }
.hint-figure { position: relative; display: inline-block; }
.hint-figure img { height: 150px; width: auto; }
.hint-bulb { position: absolute; top: -4px; inset-inline-end: -8px; width: 44px; height: 44px; border-radius: 50%; background: #f3c34d; color: #6b4e00; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: var(--shadow); }
.panel .pill { max-width: 300px; margin: 0 auto 26px; margin-bottom: calc(26px + env(safe-area-inset-bottom)); }
.seg { display: flex; background: var(--cream-2); border-radius: 12px; padding: 4px; gap: 4px; max-width: 320px; margin: 8px auto; }
.seg button { flex: 1; border-radius: 9px; padding: 11px 0; background: none; color: var(--muted); font-weight: 500; font-size: 15px; }
.seg button.on { background: var(--green); color: #fff; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; padding: 12px 16px; }
.bars .bar { flex: 1; background: var(--green); border-radius: 4px 4px 0 0; min-height: 3px; }
.heading { padding: 8px 16px 4px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.felt, .hand { direction: ltr; }
.left-handed .hand { direction: rtl; }

/* profile */
.avatar-sm { width: 36px; height: 36px; border: 2px solid var(--green); }
.prof-btn { padding: 2px; }
.prof-body { flex: 1; overflow-y: auto; padding: 8px 22px 30px; display: flex; flex-direction: column; align-items: center; text-align: center; }
/* no overflow:hidden here — the camera badge must sit ON TOP of the circle edge,
   not be clipped inside it. The image itself is rounded instead. */
.prof-photo { position: relative; width: 112px; height: 112px; flex: none; border-radius: 50%; border: 3px solid var(--green); box-shadow: var(--shadow); cursor: pointer; margin: 10px 0 12px; }
.pick-av, .metric { flex: none; }
.prof-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.prof-edit { position: absolute; bottom: -2px; inset-inline-end: -2px; z-index: 2; width: 34px; height: 34px; background: var(--green); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; border: 2px solid var(--cream); box-shadow: var(--shadow); }
.prof-name { text-align: center; font-size: 21px; font-weight: 500; border: none; border-bottom: 2px solid var(--line); background: transparent; color: var(--ink); width: 210px; padding: 4px 0; margin-bottom: 20px; font-family: inherit; }
.prof-name:focus { outline: none; border-bottom-color: var(--green); }
.prof-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 340px; margin-bottom: 24px; }
.metric { background: var(--cream-2); border-radius: 12px; padding: 12px 6px; }
.metric .m-num { font-size: 23px; font-weight: 700; color: var(--green); }
.metric .m-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
/* tappable level card */
.metric-diff { font: inherit; text-align: center; cursor: pointer; outline: 2px solid transparent; transition: outline-color .15s; }
.metric-diff:active { transform: scale(.96); }
.metric-diff .m-lbl .ti { font-size: 11px; vertical-align: -1px; opacity: .8; }
.metric .m-diff { font-size: 19px; }
.m-diff.lvl-easy { color: var(--green); }
.m-diff.lvl-normal { color: #b8801b; }
.m-diff.lvl-hard { color: var(--red); }
@keyframes valPop { 0% { transform: scale(.6); opacity: .3; } 60% { transform: scale(1.14); } 100% { transform: scale(1); opacity: 1; } }
.val-pop { animation: valPop .32s cubic-bezier(.2,.7,.3,1.5); }
.prof-pick-title { font-size: 15px; color: var(--muted); margin-bottom: 10px; align-self: flex-start; }
.prof-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; margin-bottom: 20px; }
.pick-av { aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.pick-av.sel { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.pick-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prof-upload { display: inline-flex; align-items: center; gap: 8px; background: var(--cream-2); color: var(--ink); border-radius: 30px; padding: 12px 24px; font-size: 15px; cursor: pointer; }

/* share */
.share-fab { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); inset-inline-end: 18px; width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(40,60,45,.28); z-index: 5; }
.share-fab:active { transform: scale(.94); }
.share-body { flex: 1; overflow-y: auto; padding: 14px 24px 30px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.share-lead { color: var(--muted); font-size: 15px; margin: 6px 0 20px; max-width: 300px; line-height: 1.5; }
.share-qr { width: 224px; height: 224px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.share-qr svg { width: 100%; height: 100%; display: block; }
.share-url { margin: 16px 0 22px; font-size: 14px; color: var(--muted); direction: ltr; word-break: break-all; }
.share-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }
.share-act { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 30px; background: var(--cream-2); color: var(--ink); font-size: 16px; font-weight: 500; }
.share-act .ti { font-size: 20px; }
.share-act.wa { background: #25d366; color: #0b3d24; }
.toast { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- About ---------- */
.about { flex: 1; overflow-y: auto; padding: 4px 22px 36px; text-align: center;
  display: flex; flex-direction: column; align-items: center; }
.about-photo { width: 140px; height: 140px; border-radius: 50%; overflow: hidden;
  box-shadow: var(--shadow); margin: 6px 0 14px;
  display: flex; align-items: center; justify-content: center; font-size: 60px; }
.about-photo.noimg { background: var(--cream-2); border: 4px solid var(--green); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-hi { font-size: 27px; font-weight: 700; color: var(--green); margin: 0; }
.about-hi .wave { -webkit-text-fill-color: initial; }
.about-role { color: var(--muted); font-size: 15px; margin-top: 4px; }
.about-lead { margin-top: 18px; max-width: 340px; font-size: 19px; font-weight: 500;
  line-height: 1.55; color: var(--green); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 16px 4px; }
.about-body { margin-top: 18px; max-width: 340px; }
.about-body p { font-size: 17px; line-height: 1.65; color: var(--ink); margin: 0 0 14px; }
.about-sign { margin-top: 8px; font-size: 18px; font-weight: 500; color: var(--green); max-width: 320px; }
.about-sign .s-red { color: var(--red); }
.about-contact { margin-top: 26px; width: 100%; max-width: 360px; background: var(--cream-2);
  border: 1px solid var(--line); border-radius: 18px; padding: 20px 18px; text-align: center; }
.about-contact .ac-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.about-contact .ac-text { font-size: 15px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.about-contact .ac-wa { display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 16px; background: #25d366; color: #fff; text-decoration: none;
  font-size: 18px; font-weight: 600; padding: 14px 18px; border-radius: 30px; box-shadow: var(--shadow); }
.about-contact .ac-wa:active { transform: scale(.985); }
.about-contact .ac-wa .ti { font-size: 24px; }
.about-suits { margin-top: 22px; font-size: 22px; letter-spacing: 4px; opacity: .9; }
.about-suits .s-red { color: var(--red); } .about-suits .s-blk { color: var(--green-d); }

/* ===== Guide / Rules screen ===== */
.guide-search { position: relative; margin: 4px 16px 0; display: flex; align-items: center; }
.guide-search .g-search-ic { position: absolute; inset-inline-start: 16px; font-size: 22px; color: var(--muted); pointer-events: none; }
#guide-q { flex: 1; width: 100%; background: var(--cream-2); border: 1px solid var(--line); border-radius: 30px;
  padding: 15px 48px; font-size: 17px; color: var(--ink); font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
#guide-q::placeholder { color: var(--muted); }
#guide-q:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,107,77,.14); }
#guide-q::-webkit-search-cancel-button { display: none; }
.g-clear { position: absolute; inset-inline-end: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--line); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.g-clear[hidden] { display: none; }
.g-clear .ti { font-size: 18px; }
/* autocomplete dropdown */
.guide-ac { position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 30; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; padding: 6px; }
.g-ac-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: none;
  color: var(--ink); font-size: 16px; font-family: inherit; padding: 11px 12px; border-radius: 10px; }
.g-ac-item .ti { font-size: 18px; color: var(--muted); transform: scaleX(-1); }
.g-ac-item:active, .g-ac-item:hover { background: var(--cream-2); }

.guide-intro { color: var(--muted); font-size: 14px; line-height: 1.5; padding: 12px 18px 6px; }
.guide-groups { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 16px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.guide-none { display: none; text-align: center; color: var(--muted); font-size: 16px; padding: 30px 24px; }
.guide-none[hidden] { display: none; } .guide-none:not([hidden]) { display: block; }

.g-group { background: var(--cream-2); border-radius: 16px; overflow: hidden; }
.g-group[hidden] { display: none; }
.g-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: none; color: var(--ink); padding: 16px 16px; font-size: 18px; font-weight: 500; }
.g-head .g-ic { font-size: 24px; color: var(--green); }
.g-title { flex: 1; }
.g-count { color: var(--muted); font-size: 13px; font-weight: 400; }
.g-chev { font-size: 22px; color: var(--muted); transition: transform .2s; }
.g-group.open .g-chev { transform: rotate(180deg); }
.g-body { display: none; padding: 0 12px 12px; flex-direction: column; gap: 8px; }
.g-group.open .g-body { display: flex; }
.g-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
.g-item[hidden] { display: none; }
.gi-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.gi-rule { font-size: 14px; color: var(--ink); opacity: .82; line-height: 1.5; margin-top: 4px; }
.gi-how { font-size: 14px; line-height: 1.5; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.gi-how-lbl { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 600; }
.gi-how-lbl .ti { font-size: 16px; }
.gi-how-txt { color: var(--muted); }
.g-item.flash { animation: giFlash 1.3s ease; }
@keyframes giFlash {
  0% { box-shadow: 0 0 0 0 rgba(47,107,77,.45); border-color: var(--green); }
  100% { box-shadow: 0 0 0 6px rgba(47,107,77,0); border-color: var(--line); }
}
@media (prefers-reduced-motion: reduce) { .g-item.flash { animation: none; } }
