
.sg-app, .sg-app * { box-sizing: border-box; }
.sg-app { --sg-cut: 8px; --gs-ink: #f5f5f4; --gs-muted: #a8a29e; --gs-line: #1f4a4f; --gs-accent: #22d3ee; --gs-accent-ink: #062a2e;
  --gs-panel: #0d1b1d; --gs-bg: #061012; --gs-chip: rgba(8, 30, 33, .92);
  position: relative; display: flex; flex-direction: column; color: #f5f5f4; font: 16px/1.45 "Segoe UI", system-ui, Arial, sans-serif;
  overflow: clip; -webkit-tap-highlight-color: transparent; }
.sg-app.sg-embedded { height: clamp(500px, calc(100svh - 110px), 920px); border: 1px solid #1f4a4f; background: #061012;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.sg-app.gs-fs { background: #061012; }
.sg-app .gs-stage, .sg-app .gs-main { min-height: 0; }
.sg-app.gs-wide .gs-stage { align-items: stretch; grid-template-rows: minmax(0, 1fr); }
.sg-app .gs-side { min-height: 0; overflow: auto; }
.sg-app .gs-main { display: flex; flex-direction: column; }
.sg-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
.sg-app .sg-stage, .sg-app .sg-go, .sg-app .sg-opt, .sg-app .sg-stamp, .sg-app .sg-tag, .sg-app .sg-why, .sg-app .sg-paper,
.sg-app .sg-chip, .sg-app .sg-stats span, .sg-app .sg-lv, .sg-app .sg-pop, .sg-app .sg-banner, .sg-app .sg-toast {
  clip-path: polygon(var(--sg-cut) 0, 100% 0, 100% calc(100% - var(--sg-cut)), calc(100% - var(--sg-cut)) 100%, 0 100%, 0 var(--sg-cut)); }
.sg-stage { position: relative; flex: 0 0 auto; height: 128px; overflow: hidden; background: #06191c; border: 1px solid #1f4a4f; user-select: none; -webkit-user-select: none; transition: height .35s ease; }
.sg-on-book .sg-stage { height: 176px; }
.sg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sg-hud { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 2; pointer-events: none; }
.sg-hud-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sg-tag { background: color-mix(in srgb, var(--z) 26%, #071a1c); border: 1px solid var(--z); color: #fff; font: 700 12.5px system-ui, sans-serif; padding: 3px 9px; }
.sg-chip { background: rgba(6, 26, 28, .85); border: 1px solid #1f4a4f; color: #e7e5e4; font: 600 12px system-ui, sans-serif; padding: 3px 8px; }
.sg-score { margin-left: auto; font: 800 18px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 6px #000; }
.sg-combo { font: 800 15px system-ui, sans-serif; color: #fdba74; text-shadow: 0 1px 6px #000; min-width: 10px; }
.sg-combo.hot { color: #fde047; text-shadow: 0 0 12px rgba(239, 68, 68, .9); animation: sg-throb 1.1s ease-in-out infinite; }
@keyframes sg-throb { 50% { transform: scale(1.12); } }
.sg-ink { display: inline-flex; gap: 4px; }
.sg-ink i { width: 12px; height: 16px; background: #44403c; clip-path: polygon(50% 0, 100% 62%, 80% 100%, 20% 100%, 0 62%); }
.sg-ink i.on { background: #22d3ee; box-shadow: 0 0 6px #22d3ee; }
.sg-pips { display: flex; gap: 4px; margin-top: 6px; }
.sg-pip { flex: 1 1 0; max-width: 34px; height: 6px; background: rgba(214, 211, 209, .22); }
.sg-pip.now { background: #f5f5f4; }
.sg-pip.ok { background: #4ade80; }
.sg-pip.no { background: #f87171; }
.sg-banner { --z: #22d3ee; position: absolute; left: 50%; top: 50%; z-index: 3; width: min(92%, 460px); transform: translate(-50%, -50%); padding: 10px 14px; text-align: center;
  background: color-mix(in srgb, var(--z) 30%, #071a1c); border: 2px solid var(--z); box-shadow: 0 10px 40px rgba(0, 0, 0, .6); pointer-events: none;
  animation: sg-banner 2.4s ease forwards; }
.sg-banner span { display: block; font: 700 11px monospace; letter-spacing: 1px; text-transform: uppercase; color: #fde68a; }
.sg-banner b { display: block; font: 800 22px system-ui, sans-serif; color: #fff; }
.sg-banner em { display: block; font: 500 12.5px/1.35 system-ui, sans-serif; color: #e7e5e4; font-style: normal; margin-top: 2px; }
.sg-banner.boss { --z: #ef4444; }
.sg-banner.boss b { color: #fde047; text-shadow: 0 0 14px rgba(239, 68, 68, .8); }
@keyframes sg-banner { 0% { opacity: 0; transform: translate(-30%, -50%); } 12%, 82% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-70%, -50%); } }
.sg-float { position: absolute; right: 18%; top: 45%; z-index: 3; font: 900 22px system-ui, sans-serif; color: #fde047; text-shadow: 0 2px 8px #000, 0 0 12px #ef4444;
  pointer-events: none; animation: sg-float 1.1s ease-out forwards; }
@keyframes sg-float { to { transform: translateY(-46px); opacity: 0; } }
.sg-card { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 2px 2px 4px;
  display: flex; flex-direction: column; }
.sg-on-round .sg-stage { flex: 1 1 128px; min-height: 104px; height: auto; }   
.sg-on-round .sg-card { flex: 0 1 auto; }
.sg-intro { font-size: 14.5px; color: #d6d3d1; margin: 2px 0 8px; }
.sg-intro b { color: #fff; }
.sg-due { display: block; margin-top: 4px; color: #fca5a5; font-weight: 600; font-size: 13.5px; }
.sg-book { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sg-stamp { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 64px; padding: 6px 8px 9px;
  background: color-mix(in srgb, var(--z) 12%, #0d1b1d); border: 1px solid color-mix(in srgb, var(--z) 55%, #16302f); color: #f5f5f4; text-align: left;
  cursor: pointer; font: inherit; transition: transform .15s ease, border-color .15s; }
.sg-stamp:hover { border-color: var(--z); transform: translateY(-1px); }
.sg-stamp-i { font-size: 17px; line-height: 1; }
.sg-stamp-t { font: 700 12.5px/1.2 system-ui, sans-serif; }
.sg-stamp-lv { font: 600 10.5px monospace; color: #a8a29e; }
.sg-stamp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .08); }
.sg-stamp-bar i { display: block; height: 100%; background: var(--z); }
.sg-paper { position: relative; padding: 10px 12px 12px 22px; color: #1c1917;
  background: linear-gradient(90deg, transparent 13px, rgba(13, 148, 136, .5) 13px, rgba(13, 148, 136, .5) 15px, transparent 15px), #f1f7f8;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45); }
.sg-ask { margin: 0 0 4px; font: 700 12.5px system-ui, sans-serif; color: #78716c; text-transform: uppercase; letter-spacing: .5px; }
.sg-para { --sg-lh: 44px; margin: 0; font: 500 21px/var(--sg-lh) Georgia, "Times New Roman", serif;
  background: repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--sg-lh) - 3px), rgba(56, 104, 170, .28) calc(var(--sg-lh) - 3px), rgba(56, 104, 170, .28) calc(var(--sg-lh) - 2px), transparent calc(var(--sg-lh) - 2px), transparent var(--sg-lh)); }
.sg-page .sg-para { --sg-lh: 42px; font-size: 18px; }
.sg-sent { transition: background .3s; }
.sg-sent.right { background: rgba(34, 197, 94, .1); }
.sg-sent.wrong, .sg-sent.missed { background: rgba(239, 68, 68, .08); }
.sg-tok { font: inherit; color: inherit; background: transparent; border: 0; padding: 0 2px; margin: 0; height: 40px; min-width: 40px; cursor: pointer;
  position: relative; display: inline-block; vertical-align: top; line-height: 40px; text-align: center; touch-action: manipulation; }
.sg-tok:hover:not(:disabled) { background: rgba(8, 145, 178, .12); }
.sg-tok:disabled { cursor: default; }
.sg-tok.pending { color: #b91c1c; }
.sg-tok.clean { color: #57534e; }
.sg-tok.clean::after { content: '✓'; position: absolute; top: -6px; right: -4px; font: 700 11px system-ui, sans-serif; color: #16a34a; }
.sg-tok.found { color: #b91c1c; box-shadow: inset 0 -3px 0 #dc2626, inset 0 3px 0 #dc2626; animation: sg-circle .35s ease-out; }
.sg-tok.found.first { box-shadow: inset 3px 0 0 #dc2626, inset 0 -3px 0 #dc2626, inset 0 3px 0 #dc2626; }
.sg-tok.found.last { box-shadow: inset -3px 0 0 #dc2626, inset 0 -3px 0 #dc2626, inset 0 3px 0 #dc2626; }
.sg-tok.found.first.last { box-shadow: inset 0 0 0 3px #dc2626; }
@keyframes sg-circle { from { transform: scale(1.25); opacity: .4; } }
.sg-tok.struck { color: #78716c; text-decoration: line-through 3px #dc2626; }
.sg-fixink { display: inline-block; margin: 0 4px; padding: 0 3px; font: italic 700 21px/1 "Segoe Print", "Comic Sans MS", cursive; color: #0f766e;
  transform: rotate(-3deg) translateY(-6px); animation: sg-write .5s ease-out both; }
.sg-fixink.shown { color: #15803d; }
.sg-page .sg-fixink { font-size: 18px; }
@keyframes sg-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.sg-whys { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sg-why { padding: 9px 12px; font-size: 14.5px; background: rgba(8, 30, 33, .95); border: 1px solid #1f4a4f; color: #e7e5e4; animation: sg-in .25s ease-out; }
.sg-why.ok { border-color: #22c55e; }
.sg-why.ok b { color: #4ade80; }
.sg-why.no { border-color: #f87171; }
.sg-why.no b { color: #fca5a5; }
.sg-correct { margin-top: 5px; font: 600 16px/1.4 Georgia, serif; color: #bbf7d0; }
@keyframes sg-in { from { opacity: 0; transform: translateY(6px); } }
.sg-dock { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sg-hint { flex: 1 1 200px; font-size: 14px; color: #d6d3d1; }
.sg-fixask { flex: 1 1 100%; margin: 0; color: #fca5a5; }
.sg-opts { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sg-opt { position: relative; min-height: 52px; padding: 8px 12px 8px 30px; text-align: left; background: #f1f7f8; color: #1c1917; border: 2px solid #a5c9cc;
  font: 600 17px/1.3 Georgia, serif; cursor: pointer; animation: sg-in .2s ease-out both; }
.sg-opt:nth-child(2) { animation-delay: .04s; } .sg-opt:nth-child(3) { animation-delay: .08s; } .sg-opt:nth-child(4) { animation-delay: .12s; }
.sg-opt small { position: absolute; left: 10px; top: 10px; font: 700 11px monospace; color: #a8a29e; }
.sg-opt:hover:not(:disabled) { border-color: #0891b2; }
.sg-opt.picked { border-color: #0891b2; }
.sg-opt.ok { background: #dcfce7; border-color: #22c55e; }
.sg-opt.no { background: #fee2e2; border-color: #ef4444; }
.sg-opt:disabled { cursor: default; }
.sg-go { min-height: 48px; padding: 0 22px; border: 0; background: linear-gradient(180deg, #0891b2, #0e7490); color: #fff; font: 800 15.5px system-ui, sans-serif; cursor: pointer; }
.sg-go.sg-big { flex: 1 1 100%; min-height: 58px; font-size: 17px; }
.sg-go small { display: block; font: 600 11.5px system-ui, sans-serif; color: #cffafe; }
.sg-go.sg-alt { background: #0f2a2d; color: #f5f5f4; border: 1px solid #2c5a5e; }
.sg-go.sg-small { min-height: 44px; padding: 0 14px; font-size: 13.5px; margin-left: auto; }
.sg-go.sg-clear { flex: 1 1 170px; min-height: 54px; background: linear-gradient(180deg, #16a34a, #15803d); }
.sg-go.sg-clear small { color: #dcfce7; }
.sg-healthy { display: inline-block; margin-left: 6px; padding: 0 6px; font: 700 13px/1.6 system-ui, sans-serif; color: #fff; background: #16a34a;
  transform: translateY(-4px); animation: sg-in .25s ease-out; }
.sg-sent.wrong .sg-healthy { background: #64748b; }
.sg-kind { display: inline-block; margin: 0 4px 3px 0; padding: 1px 7px; font: 700 12px system-ui, sans-serif; color: #fff;
  background: color-mix(in srgb, var(--z) 30%, #071a1c); border: 1px solid var(--z); }
.sg-end { text-align: center; padding: 14px 14px 16px 22px; }
.sg-grade { display: inline-block; font: 900 52px/1 "Segoe Print", "Comic Sans MS", cursive; color: #0e7490; border: 4px solid #0e7490; padding: 6px 16px; transform: rotate(-8deg);
  animation: sg-stampin .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.sg-grade.top { color: #b45309; border-color: #b45309; }
@keyframes sg-stampin { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } }
.sg-end-h { margin: 10px 0 8px; font: 700 17px system-ui, sans-serif; color: #292524; }
.sg-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.sg-stats span { background: #dbeaec; padding: 5px 10px; font: 600 13px system-ui, sans-serif; color: #44403c; }
.sg-stats b { color: #1c1917; }
.sg-stats em { color: #0e7490; font-style: normal; font-weight: 800; }
.sg-lv { --z: #22d3ee; position: relative; margin: 10px auto 0; max-width: 360px; padding: 6px 10px 9px; background: #0f2a2d; color: #f5f5f4; font: 600 12.5px system-ui, sans-serif; }
.sg-lv i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--z); }
.sg-lv-top { margin: 0 0 10px; max-width: none; }          
.sg-book-h { margin: 0 0 6px; font: 700 11px monospace; letter-spacing: .08em; text-transform: uppercase; color: #a8a29e; }
.sg-note { margin: 8px 0 0; font-size: 13.5px; color: #57534e; }
.sg-pass { margin: 8px 0; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: #67e8f9; background: rgba(34, 211, 238, .1);
  border-left: 3px solid #22d3ee; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.sg-paper .sg-pass { color: #0e7490; }
.sg-ov { display: flex; align-items: flex-end; justify-content: center; padding: 14px; }
.sg-pop { width: min(100%, 440px); padding: 14px 16px 16px; background: #0d1b1d; border: 2px solid var(--z); box-shadow: 0 14px 50px rgba(0, 0, 0, .7); animation: sg-in .2s ease-out; }
.sg-pop-h { font: 800 19px system-ui, sans-serif; color: #fff; }
.sg-pop-rule { margin: 8px 0; font: 500 16px/1.5 Georgia, serif; color: #e0f2f1; }
.sg-pop-stat { margin: 0 0 12px; font: 600 12.5px monospace; color: #a8a29e; }
.sg-pop-btns { display: flex; gap: 8px; }
.sg-pop-btns .sg-go { flex: 1; }
.sg-toast { position: absolute; left: 50%; bottom: 120px; z-index: 6; transform: translateX(-50%); max-width: 90%; padding: 9px 14px; background: #0f2a2d; border: 1px solid #22d3ee;
  color: #fff; font: 600 14px system-ui, sans-serif; text-align: center; pointer-events: none; animation: sg-in .2s ease-out; }
@media (min-width: 700px) {
  .sg-book { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sg-stage { height: 160px; }
  .sg-on-book .sg-stage { height: 200px; }
  .sg-para { --sg-lh: 48px; font-size: 24px; }
  .sg-page .sg-para { --sg-lh: 44px; font-size: 20px; }
  .sg-opts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 420px) {
  .sg-para { font-size: 19.5px; }
  .sg-page .sg-para { font-size: 16.5px; }
  .sg-opt { font-size: 16px; }
  .sg-stamp-t { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sg-tok.found { animation: none; }
}
@media (max-width: 420px) {   
  .sg-app .gs-title { font-size: 12px; letter-spacing: .02em; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .sg-app .gs-info:empty { display: none; }
  .sg-app .gs-tools { gap: 4px; }
}
