 :root {
   --bg: #090b12;
   --card: #121722;
   --card2: #171d2a;
   --text: #f5f7fb;
   --muted: #9ba6b8;
   --border: #273043;
   --accent: #38d9a9;
   --accent2: #4dabf7;
   --danger: #ff5d73
 }

 * {
   box-sizing: border-box
 }

 body {
   margin: 0;
   background: radial-gradient(circle at top, #111a28, #090b12 48%);
   color: var(--text);
   font-family: Inter, system-ui, sans-serif
 }

 button,
 input,
 textarea {
   font: inherit
 }

 button {
   border: 1px solid var(--border);
   background: var(--card2);
   color: var(--text);
   border-radius: 12px;
   padding: 13px 18px;
   cursor: pointer;
   font-weight: 700
 }

 button:disabled {
   opacity: .5
 }

 .primary {
   background: linear-gradient(135deg, var(--accent), var(--accent2));
   color: #071018;
   border: 0
 }

 .danger {
   background: #29151d;
   color: #ff9aaa;
   border-color: #5c2935
 }

 .page {
   max-width: 1050px;
   margin: auto;
   padding: 22px 18px 50px
 }

 .game-page-header {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 20px;
   margin-bottom: 28px
 }

 .logo {
   display: flex;
   align-items: center;
   gap: 10px;
   color: #fff;
   text-decoration: none
 }

 .site-logo {
   width: 34px;
   height: 34px
 }

 .site-name {
   font-weight: 800;
   font-size: 20px
 }

 .game-breadcrumbs {
   display: flex;
   gap: 8px;
   color: #777;
   font-size: 14px
 }

 .game-breadcrumbs a {
   color: #aaa;
   text-decoration: none
 }

 .game-breadcrumbs strong {
   color: #70e5c3
 }

 .screen {
   display: none
 }

 .screen.active {
   display: block
 }

 .hero {
   text-align: center;
   padding: 28px 10px
 }

 .badge {
   display: inline-block;
   border: 1px solid #315e54;
   background: #10251f;
   color: #75e6c5;
   border-radius: 999px;
   padding: 7px 12px;
   font-size: 12px;
   font-weight: 800
 }

 .hero h1 {
   font-size: clamp(38px, 7vw, 64px);
   margin: 14px 0 8px
 }

 .hero p {
   color: var(--muted)
 }

 .card,
 .info-card {
   background: linear-gradient(145deg, var(--card), #0f141e);
   border: 1px solid var(--border);
   border-radius: 20px;
   box-shadow: 0 20px 50px #0005
 }

 .lobby-card {
   max-width: 620px;
   margin: auto;
   padding: 25px
 }

 label {
   display: block;
   color: #cbd3df;
   font-size: 13px;
   font-weight: 700;
   margin-bottom: 8px
 }

 input,
 textarea {
   width: 100%;
   background: #0b1018;
   border: 1px solid var(--border);
   color: var(--text);
   outline: 0;
   border-radius: 12px;
   padding: 14px 15px
 }

 .match-grid {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 12px;
   margin-top: 15px
 }

 .join-row {
   display: flex;
   gap: 10px;
   margin-top: 12px
 }

 .join-row input {
   flex: 1
 }

 .message {
   text-align: center;
   color: #9fb0c5;
   min-height: 24px;
   margin-top: 14px
 }

 .info-grid {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: 14px;
   margin-top: 18px
 }

 .info-card {
   padding: 20px
 }

 .info-card p {
   color: var(--muted);
   line-height: 1.6;
   font-size: 14px
 }

 .center-card {
   max-width: 620px;
   margin: 80px auto;
   padding: 34px;
   text-align: center
 }

 .spinner {
   width: 40px;
   height: 40px;
   border: 3px solid #283344;
   border-top-color: var(--accent);
   border-radius: 50%;
   animation: spin 1s linear infinite;
   margin: 0 auto 20px
 }

 @keyframes spin {
   to {
     transform: rotate(360deg)
   }
 }

 .room-code {
   font-size: 30px;
   letter-spacing: 5px;
   font-weight: 900;
   margin: 20px;
   color: #75e6c5
 }

 .versus {
   display: grid;
   grid-template-columns: 1fr auto 1fr;
   align-items: center;
   gap: 20px;
   margin-bottom: 25px
 }

 .versus div {
   display: flex;
   flex-direction: column;
   gap: 5px
 }

 .versus span {
   font-size: 11px;
   color: #75e6c5
 }

 .battle-top {
   display: grid;
   grid-template-columns: 1fr 90px 1fr;
   gap: 15px;
   align-items: center;
   margin-bottom: 16px
 }

 .player-stat {
   background: var(--card);
   border: 1px solid var(--border);
   border-radius: 15px;
   padding: 12px 15px
 }

 .player-stat strong {
   display: block;
   font-size: 28px;
   color: #75e6c5
 }

 .player-stat small {
   color: var(--muted)
 }

 .opponent {
   text-align: right
 }

 .opponent strong {
   color: #ff91a0
 }

 .timer {
   text-align: center;
   font-size: 38px;
   font-weight: 900
 }

 .battle-card {
   padding: 24px
 }

 .battle-label {
   text-align: center;
   color: #718097;
   font-size: 11px;
   font-weight: 900;
   letter-spacing: 1.5px
 }

 .prompt {
   font-size: clamp(22px, 3.2vw, 32px);
   line-height: 1.65;
   text-align: left;
   max-width: 900px;
   margin: 18px auto;
   padding: 20px 18px;
   height: calc(1.65em * 3 + 40px);
   overflow: hidden;
   overflow-x: hidden;
   white-space: pre-wrap;
   word-break: break-word;
   scroll-behavior: auto;
   -webkit-overflow-scrolling: touch;
   overscroll-behavior: contain;
   border: 1px solid var(--border);
   border-radius: 14px;
   background: #0b1018
 }

 .prompt .correct {
   color: #70e5c3
 }

 .prompt .wrong {
   color: #ff6f7f;
   text-decoration: underline
 }

 .prompt .current {
   background: #27443d;
   border-radius: 4px
 }

 .typing-input {
   display: block;
   max-width: 820px;
   margin: auto;
   font-size: 20px;
   line-height: 1.6;
   resize: none;
   min-height: 120px
 }

 .progress {
   height: 7px;
   background: #202938;
   border-radius: 99px;
   overflow: hidden;
   max-width: 820px;
   margin: 16px auto
 }

 .progress span {
   display: block;
   height: 100%;
   width: 0;
   background: linear-gradient(90deg, var(--accent), var(--accent2))
 }

 .live-stats {
   display: flex;
   justify-content: center;
   gap: 28px;
   color: var(--muted);
   margin: 16px
 }

 .battle-message {
   text-align: center;
   color: #9fb0c5;
   min-height: 22px
 }

 .battle-leave {
   display: block;
   margin: 16px auto
 }

 .result-card {
   max-width: 680px;
   margin: 55px auto;
   padding: 35px;
   text-align: center
 }

 .result-icon {
   font-size: 64px
 }

 .result-card h2 {
   font-size: 34px
 }

 .result-card>p {
   color: var(--muted)
 }

 .result-grid {
   display: grid;
   grid-template-columns: repeat(4, 1fr);
   gap: 10px;
   margin: 24px 0
 }

 .result-grid div {
   background: #0c121b;
   border: 1px solid var(--border);
   border-radius: 13px;
   padding: 15px 8px
 }

 .result-grid span {
   display: block;
   color: var(--muted);
   font-size: 11px
 }

 .result-grid strong {
   display: block;
   font-size: 24px;
   margin-top: 5px
 }

 .opponent-result {
   border-top: 1px solid var(--border);
   padding-top: 16px;
   color: var(--muted)
 }

 .result-actions {
   display: flex;
   justify-content: center;
   gap: 12px;
   margin-top: 25px
 }

 @media(max-width:700px) {
   .page {
     padding: 16px 12px 35px
   }

   .match-grid,
   .info-grid {
     grid-template-columns: 1fr
   }

   .join-row {
     flex-direction: column
   }

   .battle-top {
     grid-template-columns: 1fr 70px 1fr
   }

   .timer {
     font-size: 30px
   }

   .player-stat strong {
     font-size: 22px
   }

   .prompt {
     font-size: 20px;
     height: calc(1.55em * 3 + 32px);
     min-height: 0;
     padding: 16px 14px;
     text-align: left
   }

   .typing-input {
     font-size: 18px
   }

   .result-grid {
     grid-template-columns: 1fr 1fr
   }

   .live-stats {
     gap: 15px;
     flex-wrap: wrap
   }
 }

 .faq-section {
   max-width: 900px;
   margin: 55px auto 0;
   text-align: center
 }

 .section-kicker {
   font-size: 11px;
   font-weight: 900;
   letter-spacing: 1.6px;
   color: #70e5c3;
   margin-bottom: 7px
 }

 .faq-section>h2 {
   font-size: 30px;
   margin: 0 0 20px
 }

 .faq-grid {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 12px;
   text-align: left
 }

 .faq-grid details {
   background: linear-gradient(145deg, #121722, #0f141e);
   border: 1px solid #273043;
   border-radius: 15px;
   padding: 16px 18px
 }

 .faq-grid summary {
   cursor: pointer;
   font-weight: 800;
   color: #edf3fa;
   list-style: none
 }

 .faq-grid summary::-webkit-details-marker {
   display: none
 }

 .faq-grid summary:after {
   content: "+";
   float: right;
   color: #70e5c3;
   font-size: 20px;
   line-height: 16px
 }

 .faq-grid details[open] summary:after {
   content: "−"
 }

 .faq-grid p {
   color: #9ba6b8;
   line-height: 1.6;
   font-size: 14px;
   margin: 12px 0 0
 }

 .lobby-card {
   box-shadow: 0 25px 70px #0008
 }

 @media(max-width:700px) {
   .faq-grid {
     grid-template-columns: 1fr
   }

   .faq-section {
     margin-top: 40px
   }

   .faq-section>h2 {
     font-size: 25px
   }
 }

 /* How to Play + FAQ */
 .how-section {
   max-width: 900px;
   margin: 55px auto 0;
   text-align: center
 }

 .how-section h2,
 .faq-section>h2 {
   font-size: 30px;
   margin: 0 0 20px
 }

 .section-kicker {
   font-size: 11px;
   font-weight: 900;
   letter-spacing: 1.6px;
   color: #70e5c3;
   margin-bottom: 7px
 }

 .steps-grid {
   display: grid;
   grid-template-columns: repeat(5, 1fr);
   gap: 12px;
   text-align: left
 }

 .steps-grid article {
   background: linear-gradient(145deg, #121722, #0f141e);
   border: 1px solid #273043;
   border-radius: 15px;
   padding: 16px
 }

 .steps-grid span {
   display: grid;
   place-items: center;
   width: 28px;
   height: 28px;
   border-radius: 50%;
   background: #70e5c3;
   color: #07100d;
   font-weight: 900;
   margin-bottom: 12px
 }

 .steps-grid h3 {
   font-size: 15px;
   margin: 0 0 7px
 }

 .steps-grid p {
   color: #9ba6b8;
   line-height: 1.5;
   font-size: 13px;
   margin: 0
 }

 .faq-section {
   max-width: 900px;
   margin: 55px auto 0;
   text-align: center
 }

 .faq-grid {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 12px;
   text-align: left
 }

 .faq-grid details {
   background: linear-gradient(145deg, #121722, #0f141e);
   border: 1px solid #273043;
   border-radius: 15px;
   padding: 16px 18px
 }

 .faq-grid summary {
   cursor: pointer;
   font-weight: 800;
   color: #edf3fa;
   list-style: none
 }

 .faq-grid summary::-webkit-details-marker {
   display: none
 }

 .faq-grid summary:after {
   content: "+";
   float: right;
   color: #70e5c3;
   font-size: 20px;
   line-height: 16px
 }

 .faq-grid details[open] summary:after {
   content: "−"
 }

 .faq-grid p {
   color: #9ba6b8;
   line-height: 1.6;
   font-size: 14px;
   margin: 12px 0 0
 }

 @media(max-width:800px) {
   .steps-grid {
     grid-template-columns: 1fr 1fr
   }
 }

 @media(max-width:700px) {
   .steps-grid {
     grid-template-columns: 1fr
   }

   .faq-grid {
     grid-template-columns: 1fr
   }

   .faq-section,
   .how-section {
     margin-top: 40px
   }

   .how-section h2,
   .faq-section>h2 {
     font-size: 25px
   }
 }

 .hp-row {
   margin-top: 8px;
   font-size: 11px;
   color: var(--muted)
 }

 .hp-row>span {
   display: flex;
   justify-content: space-between;
   margin-bottom: 4px
 }

 .hp-row b {
   color: var(--text)
 }

 .hp-track {
   height: 6px;
   background: #252d3a;
   border-radius: 99px;
   overflow: hidden
 }

 .hp-track i {
   display: block;
   width: 100%;
   height: 100%;
   background: linear-gradient(90deg, #38d9a9, #4dabf7);
   transition: width .18s ease
 }

 .opponent .hp-track i {
   background: linear-gradient(90deg, #ff6f7f, #ff9b7d)
 }

 .versus span {
   font-size: 11px;
   color: #70e5c3
 }

 .versus span:not(#meReadyStatus):not(#opReadyStatus) {}

 #meReadyStatus,
 #opReadyStatus {
   font-size: 11px;
   color: #8f9bad
 }

 #meReadyStatus.ready,
 #opReadyStatus.ready {
   color: #70e5c3
 }

 @media(max-width:700px) {

   #readyBtn,
   #readyLeaveBtn {
     display: block;
     width: 100%;
     margin-left: 0;
     margin-right: 0
   }

   .center-card #readyBtn {
     margin-bottom: 18px
   }

   .center-card #readyLeaveBtn {
     margin-top: 0
   }

   .versus {
     gap: 10px
   }

   .battle-top {
     grid-template-columns: 1fr 62px 1fr;
     gap: 8px
   }

   .player-stat {
     padding: 10px 9px
   }

   .player-stat strong {
     font-size: 20px
   }

   .hp-row {
     font-size: 10px
   }

   .battle-card {
     padding: 17px 12px
   }

   .prompt {
     padding: 16px 5px;
     font-size: 20px;
     line-height: 1.55;
     min-height: 260px
   }
 }

 .connection-status {
   display: block;
   font-size: 10px;
   letter-spacing: .7px;
   font-weight: 800;
   margin: 2px 0 4px;
   color: #8f9bad
 }

 .connection-status.online {
   color: #70e5c3
 }

 .connection-status.left {
   color: #ff7f91
 }

 @media(max-width:700px) {

   .battle-leave,
   #battleLeaveBtn {
     margin: 18px auto 4px;
     display: block;
     width: 100%;
     min-height: 46px
   }

   .connection-status {
     font-size: 9px
   }
 }

 #readyBtn+#readyLeaveBtn {
   margin-top: 14px
 }

 @media(max-width:700px) {
   #readyBtn+#readyLeaveBtn {
     margin-top: 0
   }

   .center-card #readyBtn {
     margin-bottom: 20px
   }

   .center-card #readyLeaveBtn {
     margin-top: 0
   }
 }

 /* Accuracy Master: three-line auto-scrolling passage */
 .prompt {
   overflow-y: hidden !important;
   scrollbar-width: none;
 }

 .prompt::-webkit-scrollbar {
   display: none;
 }

 @media(max-width:700px) {
   #readyBtn+#readyLeaveBtn {
     margin-top: 22px !important;
   }

   .center-card #readyLeaveBtn {
     margin-top: 22px !important;
   }
 }

 /* Passage caret: the actual textarea captures input, while this caret stays
   inside the displayed passage and moves with the typed position. */
 .prompt .current {
   position: relative;
   background: transparent;
   border-radius: 0;
 }

 .prompt .current::before {
   content: "";
   position: absolute;
   left: -2px;
   top: 8%;
   width: 2px;
   height: 84%;
   background: var(--accent);
   border-radius: 2px;
   animation: accuracyCaret 1s steps(1, end) infinite;
 }

 .prompt .current-end {
   display: inline-block;
   width: 0.05em;
   height: 1em;
   vertical-align: middle;
 }

 @keyframes accuracyCaret {

   0%,
   49% {
     opacity: 1
   }

   50%,
   100% {
     opacity: 0
   }
 }

 .typing-input {
   position: absolute !important;
   width: 1px !important;
   height: 1px !important;
   min-height: 1px !important;
   padding: 0 !important;
   margin: 0 !important;
   opacity: 0 !important;
   pointer-events: none !important;
   border: 0 !important;
   caret-color: transparent !important;
 }

 .prompt {
   cursor: text
 }


 /* Direct passage typing */
 .typing-instruction {
   max-width: 900px;
   margin: 10px auto 16px;
   color: var(--muted);
   font-size: 13px;
   line-height: 1.6;
   text-align: center
 }

 .typing-instruction b {
   color: #dce7f2
 }

 .prompt {
   cursor: text;
   outline: none;
   caret-color: var(--accent);
   user-select: none;
   -webkit-user-select: none;
   overflow-y: auto;
   scrollbar-width: none
 }

 .prompt::-webkit-scrollbar {
   display: none
 }

 .prompt:focus {
   border-color: #3a6259;
   box-shadow: 0 0 0 2px #38d9a91a
 }

 .typing-input {
   display: none !important
 }

 @media(max-width:700px) {
   .typing-instruction {
     font-size: 12px;
     margin: 8px 4px 12px
   }

   .prompt {
     min-height: 260px
   }
 }

 /* Accuracy Master battle UI — passage-first layout */
 .battle-top {
   width: min(1480px, calc(100vw - 36px));
   margin: 0 auto 20px;
   grid-template-columns: minmax(240px, 1fr) 120px minmax(240px, 1fr);
   gap: 22px;
 }

 .player-stat {
   padding: 14px 18px;
   background: rgba(18, 23, 34, .88);
 }

 .player-line {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
   margin-bottom: 8px;
 }

 .player-line>span:first-child {
   font-size: 15px;
   font-weight: 800;
 }

 .player-stat .hp-value {
   display: block;
   font-size: 25px;
   color: #f5f7fb;
   margin: 0 0 8px;
 }

 .player-stat .hp-value span {
   color: #70e5c3
 }

 .player-stat.opponent .hp-value span {
   color: #ff91a0
 }

 .player-stat .hp-track {
   height: 8px
 }

 .connection-status {
   display: inline-flex;
   align-items: center;
   font-size: 10px;
   line-height: 1;
   font-weight: 900;
   letter-spacing: .6px;
   color: #70e5c3;
   white-space: nowrap;
 }

 .connection-status.left {
   color: #ff9aaa
 }

 .timer {
   font-size: 34px;
   color: #ffd43b;
   white-space: nowrap;
 }

 .battle-card {
   width: min(1480px, calc(100vw - 36px));
   margin: 0 auto;
   padding: 26px 28px 24px;
 }

 .typing-instruction {
   max-width: 1000px;
   margin: 8px auto 10px;
   color: #7f8ba0;
   font-size: 12px;
   line-height: 1.55;
   text-align: center;
 }

 .typing-instruction b {
   color: #cfd8e5
 }

 .prompt {
   max-width: 1450px;
   margin: 20px auto 16px;
   padding: 0 4px;
   height: calc(1.65em * 3 + 4px);
   min-height: 0;
   border: 0;
   border-radius: 0;
   background: transparent;
   box-shadow: none;
   color: #8f98a8;
   font-size: clamp(24px, 2.35vw, 36px);
   line-height: 1.65;
   text-align: left;
   white-space: pre-wrap;
   word-break: normal;
   overflow-x: hidden;
   overflow-y: auto;
   scrollbar-width: none;
   -webkit-overflow-scrolling: auto;
   outline: none;
   cursor: text;
   caret-color: #16d7e8;
 }

 .prompt::-webkit-scrollbar {
   display: none
 }

 .prompt:focus {
   border: 0;
   box-shadow: none
 }

 .progress {
   max-width: 1200px;
   margin: 12px auto
 }

 .live-stats {
   margin: 12px 0 10px
 }

 .battle-message {
   font-size: 12px
 }

 .battle-card>.danger {
   display: block;
   margin: 16px auto 0
 }

 @media(max-width:700px) {
   .battle-top {
     width: 100%;
     grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
     gap: 8px;
     margin-bottom: 12px;
   }

   .player-stat {
     padding: 10px 9px;
     border-radius: 12px
   }

   .player-line {
     gap: 6px;
     margin-bottom: 6px
   }

   .player-line>span:first-child {
     font-size: 12px
   }

   .connection-status {
     font-size: 8px
   }

   .player-stat .hp-value {
     font-size: 19px;
     margin-bottom: 6px
   }

   .player-stat .hp-track {
     height: 6px
   }

   .timer {
     font-size: 24px
   }

   .battle-card {
     width: 100%;
     padding: 18px 8px 18px;
     border-radius: 16px;
   }

   .typing-instruction {
     font-size: 11px;
     margin: 7px 3px 10px
   }

   .prompt {
     max-width: none;
     padding: 0 2px;
     margin: 18px 0 12px;
     font-size: 20px;
     line-height: 1.55;
     height: calc(1.55em * 3 + 4px);
   }
 }


 /* Full-width battle stage to match the clean passage-first design. */
 .battle.screen.active {
   width: 100vw;
   margin-left: calc(50% - 50vw);
 }

 .battle-card {
   background: transparent;
   border: 0;
   box-shadow: none;
 }

 @media(max-width:700px) {
   .battle.screen.active {
     width: 100vw;
     margin-left: calc(50% - 50vw)
   }
 }

 /* Accuracy Master final typing surface */
 .battle-card {
   width: min(1520px, calc(100vw - 28px));
   padding: 20px 22px 24px;
   margin: 0 auto;
   background: transparent;
   border: 0;
   box-shadow: none
 }

 .typing-instruction {
   max-width: 1050px;
   margin: 4px auto 14px;
   color: #7f8ba0;
   font-size: 12px;
   line-height: 1.55;
   text-align: center
 }

 .prompt {
   width: min(1450px, 100%);
   max-width: 1450px;
   height: calc(3 * 1.55em);
   min-height: calc(3 * 1.55em);
   max-height: calc(3 * 1.55em);
   margin: 16px auto 14px;
   padding: 0 4px;
   border: 0;
   border-radius: 0;
   background: transparent;
   box-shadow: none;
   color: #8f98a8;
   font-size: clamp(23px, 2.15vw, 34px);
   line-height: 1.55;
   text-align: left;
   white-space: pre-wrap;
   word-break: normal;
   overflow: hidden !important;
   overflow-x: hidden !important;
   overflow-y: hidden !important;
   scrollbar-width: none;
   -webkit-overflow-scrolling: auto;
   scroll-behavior: auto;
   outline: none;
   cursor: text;
   caret-color: #16d7e8;
   user-select: none;
   -webkit-user-select: none;
   contain: layout paint;
 }

 .prompt::-webkit-scrollbar {
   display: none
 }

 .prompt .passage-char {
   color: #8f98a8;
   white-space: pre
 }

 .prompt .passage-char.correct {
   color: #38d9a9
 }

 .prompt .passage-char.wrong {
   color: #ff5d73
 }

 .prompt:focus {
   border: 0;
   box-shadow: none
 }

 /* The viewport itself never reveals a fourth line. Scrolling is controlled by JS. */
 @media(max-width:700px) {
   .battle-card {
     width: 100vw;
     padding: 16px 8px 20px
   }

   .typing-instruction {
     font-size: 11px;
     margin: 4px 5px 10px
   }

   .prompt {
     width: 100%;
     height: calc(3 * 1.5em);
     min-height: calc(3 * 1.5em);
     max-height: calc(3 * 1.5em);
     margin: 14px 0 12px;
     padding: 0 3px;
     font-size: 20px;
     line-height: 1.5;
   }
 }

 /* Keep the battle HUD compact and close to the reference design. */
 .battle-top {
   width: min(1520px, calc(100vw - 28px));
   margin: 0 auto 10px;
   grid-template-columns: minmax(220px, 1fr) 110px minmax(220px, 1fr);
   gap: 18px
 }

 .player-stat {
   padding: 11px 15px;
   border-radius: 14px
 }

 .player-stat .hp-value {
   font-size: 24px;
   margin: 0 0 7px
 }

 .player-stat .hp-track {
   height: 7px
 }

 .timer {
   font-size: 32px
 }

 .progress {
   max-width: 1200px;
   margin: 10px auto;
   height: 6px
 }

 .live-stats {
   margin: 10px 0 8px
 }

 .battle-message {
   min-height: 20px
 }

 @media(max-width:700px) {
   .battle-top {
     width: 100%;
     grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr);
     gap: 6px;
     margin-bottom: 8px
   }

   .player-stat {
     padding: 9px 8px
   }

   .player-stat .hp-value {
     font-size: 18px
   }

   .timer {
     font-size: 22px
   }
 }


 /* Accuracy Master final typing viewport: exactly three visible lines. */
 .prompt {
   height: calc(1.65em * 3) !important;
   min-height: 0 !important;
   max-height: calc(1.65em * 3) !important;
   padding: 0 4px !important;
   overflow: hidden !important;
   overflow-x: hidden !important;
   overflow-y: hidden !important;
   scroll-behavior: auto !important;
   -webkit-overflow-scrolling: auto !important;
   overscroll-behavior: none !important;
 }

 .prompt .passage-char {
   white-space: pre !important;
 }

 .prompt .passage-char.correct {
   color: #38d9a9 !important;
 }

 .prompt .passage-char.wrong {
   color: #ff5d73 !important;
 }

 @media(max-width:700px) {
   .prompt {
     height: calc(1.55em * 3) !important;
     min-height: 0 !important;
     max-height: calc(1.55em * 3) !important;
     padding: 0 2px !important;
     font-size: 20px !important;
     line-height: 1.55 !important;
   }
 }

 /* Accuracy Master live player stat panel */
 .player-live-stats {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 12px;
   max-width: 900px;
   margin: 16px auto
 }

 .live-stat-card {
   background: #0b1018;
   border: 1px solid var(--border);
   border-radius: 14px;
   padding: 12px 14px
 }

 .live-stat-title {
   font-size: 11px;
   font-weight: 900;
   letter-spacing: 1.5px;
   color: #8f9bad;
   margin-bottom: 9px
 }

 .opponent-live .live-stat-title {
   color: #ff91a0
 }

 .live-stat-row {
   display: grid;
   grid-template-columns: repeat(4, 1fr);
   gap: 8px;
   color: #9ba6b8;
   font-size: 12px
 }

 .live-stat-row span {
   display: flex;
   justify-content: center;
   gap: 4px;
   white-space: nowrap
 }

 .live-stat-row b {
   color: #f5f7fb;
   font-size: 15px
 }

 @media(max-width:700px) {
   .player-live-stats {
     grid-template-columns: 1fr;
     gap: 8px;
     margin: 12px auto
   }

   .live-stat-row {
     grid-template-columns: repeat(2, 1fr);
     row-gap: 7px
   }
 }

 /* Accuracy Master - full two-player result calculation */
 .result-card-wide {
   max-width: 920px
 }

 .result-summary {
   display: grid;
   grid-template-columns: 1fr 70px 1fr;
   align-items: center;
   gap: 12px;
   margin: 24px auto;
   max-width: 760px
 }

 .result-player {
   background: #0b1018;
   border: 1px solid var(--border);
   border-radius: 16px;
   padding: 16px
 }

 .result-player-name {
   font-size: 12px;
   font-weight: 900;
   letter-spacing: 1.3px;
   color: #75e6c5
 }

 .result-op .result-player-name {
   color: #ff91a0
 }

 .result-player strong {
   display: block;
   font-size: 42px;
   margin: 5px 0 0
 }

 .result-player span {
   font-size: 10px;
   color: var(--muted);
   font-weight: 800
 }

 .result-vs {
   font-weight: 900;
   color: #6f7c90
 }

 .calculation-title {
   text-align: left;
   font-size: 12px;
   font-weight: 900;
   letter-spacing: 1.4px;
   color: #718097;
   margin: 28px 0 12px
 }

 .score-chart {
   background: #0b1018;
   border: 1px solid var(--border);
   border-radius: 16px;
   padding: 18px
 }

 .chart-row {
   padding: 12px 0;
   border-bottom: 1px solid #1d2634
 }

 .chart-row:last-child {
   border-bottom: 0
 }

 .chart-label {
   display: flex;
   justify-content: space-between;
   gap: 12px;
   font-size: 12px;
   color: #aab4c3;
   margin-bottom: 8px
 }

 .chart-label b {
   color: #718097;
   font-size: 10px
 }

 .chart-bars {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 10px
 }

 .bar-track {
   height: 10px;
   background: #1c2634;
   border-radius: 99px;
   overflow: hidden
 }

 .bar-track i {
   display: block;
   height: 100%;
   width: 0;
   background: linear-gradient(90deg, var(--accent), var(--accent2));
   border-radius: 99px;
   transition: width .35s ease
 }

 .opponent-bar i {
   background: linear-gradient(90deg, #ff5d73, #ff91a0)
 }

 .formula-box {
   margin-top: 14px;
   padding: 13px 15px;
   background: #101722;
   border: 1px solid var(--border);
   border-radius: 12px;
   color: #b8c2d0;
   line-height: 1.65;
   font-size: 12px;
   text-align: left
 }

 .formula-box small {
   color: #718097
 }

 .result-details {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 12px;
   margin-top: 14px
 }

 .result-details>div {
   background: #0c121b;
   border: 1px solid var(--border);
   border-radius: 13px;
   padding: 14px;
   text-align: left
 }

 .result-details h3 {
   font-size: 11px;
   letter-spacing: 1.2px;
   margin: 0 0 8px;
   color: #75e6c5
 }

 .result-details>div:last-child h3 {
   color: #ff91a0
 }

 .result-details p {
   margin: 0;
   color: var(--muted);
   font-size: 12px;
   line-height: 1.8
 }

 .result-details b {
   color: #f5f7fb
 }

 @media(max-width:700px) {
   .result-card-wide {
     padding: 22px 14px
   }

   .result-summary {
     grid-template-columns: 1fr;
     gap: 8px
   }

   .result-vs {
     order: 2
   }

   .result-op {
     order: 3
   }

   .result-player strong {
     font-size: 34px
   }

   .chart-bars {
     grid-template-columns: 1fr
   }

   .result-details {
     grid-template-columns: 1fr
   }
 }

 .chart-legend {
   display: flex;
   justify-content: flex-end;
   gap: 18px;
   color: #8f9bad;
   font-size: 10px;
   font-weight: 900;
   letter-spacing: 1px;
   margin: 0 2px 8px
 }

 .chart-legend i {
   display: inline-block;
   width: 8px;
   height: 8px;
   border-radius: 50%;
   margin-right: 5px
 }

 .legend-you {
   background: var(--accent)
 }

 .legend-op {
   background: #ff5d73
 }

 .arithmetic-lines {
   margin-top: 10px;
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 8px
 }

 .arithmetic-lines div {
   padding: 9px 10px;
   border: 1px solid var(--border);
   border-radius: 9px;
   background: #0b1018
 }

 .arithmetic-lines b {
   font-size: 12px;
   color: #f5f7fb
 }

 .arithmetic-lines div:last-child b {
   color: #ffb0ba
 }

 @media(max-width:700px) {
   .chart-legend {
     justify-content: center
   }

   .arithmetic-lines {
     grid-template-columns: 1fr
   }
 }

 /* FINAL RESULT CHART: YOU and OPPONENT stay on the same line. */
 .score-chart .chart-row {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 28px;
   padding: 16px 0;
   border-bottom: 1px solid #1d2634;
 }

 .score-chart .chart-row:last-child {
   border-bottom: 0
 }

 .score-chart .chart-side {
   min-width: 0
 }

 .score-chart .chart-title {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 8px;
   margin-bottom: 9px;
   font-size: 12px;
   font-weight: 900;
   letter-spacing: .7px;
   color: #aab4c3;
 }

 .score-chart .chart-title b {
   font-size: 12px;
   color: #75e6c5
 }

 .score-chart .opponent-side .chart-title b {
   color: #ff91a0
 }

 .score-chart .chart-player-line {
   display: grid;
   grid-template-columns: 58px minmax(0, 1fr) auto;
   align-items: center;
   gap: 8px;
 }

 .score-chart .chart-player {
   font-size: 10px;
   font-weight: 900;
   letter-spacing: 1px;
   color: #75e6c5;
   white-space: nowrap;
 }

 .score-chart .opponent-side .chart-player {
   color: #ff91a0
 }

 .score-chart .bar-track {
   height: 10px;
   min-width: 0;
   background: #1c2634;
   border-radius: 99px;
   overflow: hidden;
 }

 .score-chart .bar-track i {
   display: block;
   height: 100%;
   width: 0;
   border-radius: 99px;
   background: linear-gradient(90deg, var(--accent), var(--accent2));
   transition: width .35s ease;
 }

 .score-chart .opponent-side .bar-track i {
   background: linear-gradient(90deg, #ff5d73, #ff91a0);
 }

 .score-chart .chart-player-line strong {
   min-width: 52px;
   text-align: right;
   font-size: 10px;
   color: #718097;
   white-space: nowrap;
 }

 .score-chart .opponent-side .chart-player-line strong {
   color: #a77b83
 }

 @media(max-width:700px) {
   .score-chart .chart-row {
     grid-template-columns: 1fr;
     gap: 16px
   }
 }