/* Simulator styles. Loaded after /assets/site/shell.css; plain CSS, no utility framework. */
.px-card > .px-lede { margin: 0 0 22px; }

#gia-app {
  position: relative;
  font-variant-numeric: tabular-nums;
}
:where(#gia-app) :where(h1, h2, h3, h4, p, ul, ol, li, div, span, button, select) { margin: 0; padding: 0; }
#gia-app button, #gia-app select { font-family: inherit; }
#gia-app .hidden { display: none !important; }
#gia-app :focus-visible { outline-color: var(--g-ink); }

.icon { display: inline-block; width: 1em; height: 1em; fill: currentColor; vertical-align: -.125em; flex: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Controls row */
.sim-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px; background: var(--g-tint); border-bottom: 1px solid var(--g-line); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--g-edge); border-radius: 2px; }
.seg-btn { display: inline-block; text-align: center; line-height: 1.3; min-height: 40px; padding: 9px 14px; border: 0; border-radius: 2px; background: transparent; color: var(--g-ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.seg-btn .icon { margin-right: 7px; }
.seg-btn:hover { background: var(--g-tint); }
.seg-btn.is-active { background: var(--g-ink); color: var(--g-bg); font-weight: 700; }
.select { min-height: 44px; padding: 0 12px; background: #fff; color: var(--g-ink); border: 1px solid var(--g-edge); border-radius: 2px; font-size: 15px; font-weight: 600; cursor: pointer; }
.tips-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; background: transparent; color: var(--g-ink); border: 1px solid var(--g-edge); border-radius: 2px; font-size: 15px; font-weight: 600; cursor: pointer; }
.tips-btn:hover { background: #fff; }

.sim-body { padding: clamp(14px, 3vw, 28px); }
.exercise { max-width: 40rem; margin-inline: auto; position: relative; }

/* Progress and meta */
.progress { height: 8px; background: #dde3da; border: 1px solid var(--g-edge); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--px-shell-lo); transition: width .3s linear; }
.meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--g-muted); }
.meta-left { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mode-badge { padding: 3px 10px; border-radius: 2px; font-size: 14px; font-weight: 700; border: 1px solid; }
.mode-badge.is-timed { background: #fde7d3; color: #6e2900; border-color: #d98a52; }
.mode-badge.is-practice { background: var(--g-ok-bg); color: var(--g-ok); border-color: var(--g-ok-line); }
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; color: var(--g-bad); background: var(--g-bad-bg); border: 1px solid var(--g-bad-line); border-radius: 2px; font-size: 16px; font-weight: 700; }
.timer-label { font-size: 18px; font-weight: 800; }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* Prompt */
.prompt { text-align: center; padding: 16px 0 6px; }
.prompt h2 { font: 800 clamp(22px, 4vw, 26px)/1.25 var(--px-sans); text-wrap: balance; }
.prompt p { font-size: 16px; color: var(--g-muted); margin-top: 6px; }
.prompt .same { color: var(--g-ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--px-shell-lo); text-underline-offset: 3px; }
.prompt .not { color: var(--g-bad); font-weight: 700; }

/* Boxes and letters */
.stage { display: flex; flex-direction: column; align-items: center; padding: 14px 0 6px; }
.boxes { display: flex; justify-content: center; gap: clamp(20px, 6vw, 48px); width: 100%; }
.box-col { display: flex; flex-direction: column; align-items: center; }
.box-frame { position: relative; width: 112px; height: 164px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; padding: 12px; background: #fff; border: 2px solid var(--g-edge); border-radius: 2px; transition: border-color .25s, background-color .25s; }
.box-frame.is-match { border-color: var(--g-ok); background: #f6f9ee; }
.box-frame.is-nomatch { border-color: var(--g-bad); background: #fdf3f0; }
.box-rule { width: 48px; height: 1px; background: var(--g-line); }
.box-name { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--g-muted); }
.letter { font: 700 52px/1 var(--px-sans); color: var(--g-ink); user-select: none; font-feature-settings: "liga" 0; }
.letter-sm { font-size: 28px; }
.glyph-anim { transition: transform .5s cubic-bezier(.34, 1.4, .64, 1); display: inline-block; transform-origin: center center; }
.box-badge { position: absolute; top: -12px; right: -12px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid #fff; color: #fff; font-size: 13px; }
.box-badge.is-ok { background: var(--g-ok); }
.box-badge.is-bad { background: var(--g-bad); }
.box-badge-sm { top: -10px; right: -10px; width: 24px; height: 24px; font-size: 11px; }

.align-row { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.btn-soft, .btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 2px; font-size: 15px; font-weight: 700; cursor: pointer; border: 1px solid transparent; }
.btn-soft { background: #fff; color: var(--g-ink); border-color: var(--g-edge); }
.btn-soft:hover { background: var(--g-tint); }
.btn-primary { background: var(--px-shell); color: var(--px-print); }
.btn-primary:hover { background: var(--px-shell-lo); }
.btn-quiet { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--g-muted); border: 1px solid transparent; border-radius: 2px; font-size: 16px; cursor: pointer; }
.btn-quiet:hover { background: #fff; color: var(--g-ink); border-color: var(--g-line); }

/* Answer buttons */
.answers { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.options { display: flex; justify-content: center; gap: 14px; width: 100%; max-width: 22rem; }
.btn-option { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; min-height: 76px; background: #fff; color: var(--g-ink); border: 2px solid var(--g-edge); border-radius: 2px; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn-option:hover { background: var(--g-tint); border-color: var(--g-ink); }
.btn-option:active { background: #dde3da; }
.opt-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.kbd-tag { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.3; padding: 1px 6px; border: 1px solid var(--g-edge); border-radius: 2px; background: var(--g-bg); color: var(--g-muted); }
.key-hint { margin-top: 10px; font-size: 14px; color: var(--g-muted); text-align: center; }
.key-hint kbd { font: 700 14px var(--px-sans); color: var(--g-ink); }

/* Feedback */
.feedback { margin-top: 16px; padding: 16px; background: #fff; border: 1px solid var(--g-line); border-radius: 2px; }
.feedback-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.feedback-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.feedback-heading { font-size: 16px; font-weight: 700; }
.feedback .kbd-tag { background: transparent; color: var(--px-print); border-color: rgba(42, 15, 2, .6); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 2px; font-size: 13px; font-weight: 800; letter-spacing: .02em; border: 1px solid; }
.pill.is-ok { background: var(--g-ok-bg); color: var(--g-ok); border-color: var(--g-ok-line); }
.pill.is-bad { background: var(--g-bad-bg); color: var(--g-bad); border-color: var(--g-bad-line); }
.notes { display: grid; gap: 8px; margin-top: 12px; }
.note, .review-note { padding: 10px 12px; border-radius: 2px; font-size: 15px; line-height: 1.5; color: var(--g-ink); border: 1px solid var(--g-line); }
.note.is-ok { background: var(--g-ok-bg); border-color: var(--g-ok-line); }
.note.is-bad { background: var(--g-bad-bg); border-color: var(--g-bad-line); }

/* Results */
.results { max-width: 46rem; margin-inline: auto; }
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--g-line); }
.results-head h2 { font: 800 clamp(22px, 4vw, 26px)/1.25 var(--px-sans); }
.results-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 22px 0; }
.stat { padding: 12px; background: #fff; border: 1px solid var(--g-line); border-radius: 2px; text-align: center; }
.stat.is-ok { background: var(--g-ok-bg); border-color: var(--g-ok-line); color: var(--g-ok); }
.stat.is-bad { background: var(--g-bad-bg); border-color: var(--g-bad-line); color: var(--g-bad); }
.stat-label { display: block; font-size: 14px; font-weight: 700; }
.stat:not(.is-ok):not(.is-bad) .stat-label { color: var(--g-muted); }
.stat-num { font: 400 28px/1.2 var(--px-pixel); margin-top: 6px; }
.stat:not(.is-ok):not(.is-bad) .stat-num { color: var(--g-ink); }
.stat-sub { display: block; font: 600 14px/1.3 var(--px-sans); color: var(--g-muted); margin-top: 2px; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 28px 0 14px; }
.review-head h3 { font: 800 17px/1.3 var(--px-sans); display: flex; align-items: center; gap: 8px; }
.review-items { display: grid; gap: 14px; max-height: 34rem; overflow-y: auto; padding-right: 4px; }
.review-card { padding: 14px; border: 1px solid; border-radius: 2px; background: #fff; }
.review-card.is-ok { border-color: var(--g-ok-line); }
.review-card.is-bad { border-color: var(--g-bad-line); }
.review-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--g-line); font-size: 15px; }
.review-id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.review-qn { font-weight: 700; }
.review-time { font-size: 14px; color: var(--g-muted); }
.review-choice { font-weight: 600; }
.review-choice .ok-text, .review-choice .bad-text, .review-correct { font-weight: 800; }
.review-preview { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 24px; margin: 14px 0; }
.rev-box { text-align: center; }
.rev-frame { position: relative; width: 72px; height: 112px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; padding: 6px; background: #fff; border: 1px solid var(--g-edge); border-radius: 2px; }
.rev-frame .box-rule { width: 32px; }
.rev-box .box-name { display: block; }
.review-notes { display: grid; gap: 8px; }
.review-note { background: var(--g-bg); }
.review-empty { padding: 36px 16px; text-align: center; color: var(--g-muted); background: var(--g-bg); border: 1px dashed var(--g-edge); border-radius: 2px; font-size: 15px; }
.review-empty-icon { font-size: 40px; color: var(--g-ok); margin-bottom: 8px; }
.review-empty-title { font-size: 16px; font-weight: 700; color: var(--g-ink); }

.fade-enter { animation: fadeIn .2s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }

/* Tips modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 24, 16, .78); }
.modal-panel { position: relative; width: 100%; max-width: 36rem; max-height: 90vh; overflow-y: auto; padding: clamp(20px, 4vw, 32px); background: var(--g-bg); color: var(--g-ink); border-radius: 2px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7); }
.modal-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--g-muted); border: 0; border-radius: 2px; font-size: 18px; cursor: pointer; }
.modal-x:hover { background: #fff; color: var(--g-ink); }
.modal-head { display: flex; align-items: center; gap: 14px; margin: 0 40px 18px 0; }
.modal-icon { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: #fde7d3; color: #6e2900; border-radius: 2px; font-size: 20px; }
.modal-head h2 { font: 800 19px/1.3 var(--px-sans); }
.modal-head p { font-size: 14px; color: var(--g-muted); margin-top: 2px; }
.tips { display: grid; gap: 14px; font-size: 15px; line-height: 1.55; }
.tip { padding: 14px 16px; background: #fff; border: 1px solid var(--g-line); border-radius: 2px; }
.tip h3 { display: flex; align-items: center; gap: 10px; font: 800 16px/1.3 var(--px-sans); margin-bottom: 6px; }
.tip-n { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--g-ink); color: var(--g-bg); font-size: 14px; font-weight: 700; }
.tip ul, .tip ol { margin-top: 6px; padding-left: 1.3em; display: grid; gap: 4px; }
.tip ul { list-style: disc; }
.tip ol { list-style: decimal; }
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 0; padding: 8px; background: var(--g-bg); border: 1px solid var(--g-line); border-radius: 2px; text-align: center; }
.demo-cap { display: block; font-size: 14px; color: var(--g-muted); }
.demo-letter { display: inline-block; font-size: 32px; margin: 6px 0; }
.demo p { font-size: 14px; color: var(--g-muted); }
.rot180 { transform: rotate(180deg); }
.flip { transform: scaleX(-1); }
.ok-text { color: var(--g-ok); }
.bad-text { color: var(--g-bad); }
.modal-foot { margin-top: 20px; display: flex; justify-content: flex-end; }

/* About text under the tool */
.tool-about { margin-top: 36px; max-width: 46rem; }
.tool-about h2 { font: 800 1.45rem/1.25 var(--px-sans); margin: 0 0 .5rem; }
.tool-about p { margin: .8rem 0; max-width: 68ch; }
.tool-about .disc { color: var(--px-muted); }

@media (max-width: 480px) {
  .box-frame { width: 100px; height: 150px; }
  .letter { font-size: 44px; }
  .options { gap: 10px; }
  .sim-bar { padding: 12px; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 140px; }
  .demo { grid-template-columns: 1fr; }
}
@media (prefers-color-scheme: dark) {
  #gia-app { border: 2px solid #0f1810; box-shadow: 0 0 0 1px rgba(214, 245, 226, .22), 0 14px 32px -16px rgba(0, 0, 0, .75); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .fade-enter { animation: none; }
  .glyph-anim, .progress-fill, .box-frame, .btn-option { transition: none; }
}
