/* =========================================
       わくわく算数
       COLORFUL ADVENTURE DESIGN
    ========================================= */
    
    :root {
      --purple: #7656db;
      --purple-dark: #5739b7;
      --purple-light: #f0eaff;
    
      --yellow: #ffdc62;
      --orange: #ff985e;
      --orange-light: #fff0e5;
    
      --green: #63cfa7;
      --green-light: #e6f9ef;
    
      --blue: #70b8ed;
      --pink: #ff91b8;
    
      --text: #40395e;
      --text-light: #89839d;
    
      --background: #f8f5ff;
      --white: #ffffff;
    
      --radius-large: 28px;
      --radius-medium: 18px;
    
      --shadow:
        0 10px 30px rgba(91, 67, 156, 0.09);
    }
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    html {
      scroll-behavior: smooth;
    }
    
    body {
      font-family:
        "M PLUS Rounded 1c",
        sans-serif;
    
      color: var(--text);
      background: var(--background);
    
      line-height: 1.8;
      overflow-x: hidden;
    }
    
    button,
    input,
    select {
      font: inherit;
    }
    
    button {
      cursor: pointer;
      /* ダブルタップズーム抑止（2026-11-28）：連打されうるボタン全般に manipulation。
         iOS Safari は viewport の user-scalable=no を無視するため、touch-action が本命 */
      touch-action: manipulation;
    }
    
    a {
      color: inherit;
      text-decoration: none;
    }
    
    main {
      width: 100%;
    }
    
    
    /* =========================================
       背景装飾
    ========================================= */
    
    .background-decoration {
      position: absolute;
      pointer-events: none;
      z-index: 0;
      font-weight: 900;
    }
    
    .decoration-one {
      top: 430px;
      left: 3%;
      color: #ffd96d;
      font-size: 48px;
    }
    
    .decoration-two {
      top: 1050px;
      right: 4%;
      color: #ffb2cc;
      font-size: 35px;
    }
    
    .decoration-three {
      top: 1850px;
      left: 2%;
      color: #9c8be9;
      font-size: 40px;
    }
    
    .decoration-four {
      top: 2500px;
      right: 5%;
      color: #83dfbd;
      font-size: 30px;
    }
    
    
    /* =========================================
       ヘッダー
    ========================================= */
    
    .site-header {
      background: rgba(255,255,255,0.95);
      border-bottom: 1px solid #eee9fb;
      position: relative;
      z-index: 5;
    }
    
    .header-inner {
      max-width: 1160px;
      margin: auto;
      padding: 14px 24px;
    
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
    }
    
    .site-logo {
      display: flex;
      align-items: center;
      gap: 11px;
    }
    
    .logo-icon {
      font-size: 34px;
      background: #fff1b8;
      width: 48px;
      height: 48px;
      border-radius: 15px;
    
      display: grid;
      place-items: center;
    }
    
    .logo-text {
      display: flex;
      flex-direction: column;
      line-height: 1.4;
    }
    
    .logo-text strong {
      font-size: 17px;
      font-weight: 900;
      color: var(--purple-dark);
    }
    
    .logo-text small {
      font-size: 9px;
      letter-spacing: 1.5px;
      font-weight: 800;
      color: #aaa1c7;
    }
    
    .header-nav {
      display: flex;
      gap: 30px;
      font-size: 13px;
      font-weight: 800;
    }
    
    .header-nav a {
      transition: color .2s;
    }
    
    .header-nav a:hover {
      color: var(--purple);
    }
    
    .header-badge {
      background: #fff6d9;
      color: #9e771f;
      padding: 8px 16px;
      border-radius: 30px;
      font-size: 12px;
      font-weight: 800;
    }
    
    
    /* =========================================
       メインビジュアル
    ========================================= */
    
    .hero {
      max-width: 1160px;
      margin: auto;
      padding: 85px 30px 75px;
    
      display: grid;
      grid-template-columns: 1fr 1fr;
      align-items: center;
      gap: 50px;
    
      position: relative;
    }
    
    .hero-content {
      position: relative;
      z-index: 1;
    }
    
    .hero-label {
      display: inline-block;
      background: #fff0ba;
      color: #9c7218;
    
      border-radius: 30px;
      padding: 7px 18px;
    
      font-size: 13px;
      font-weight: 900;
    
      margin-bottom: 20px;
    }
    
    .hero h1 {
      font-size: clamp(38px, 5vw, 61px);
      line-height: 1.4;
      letter-spacing: -2px;
      font-weight: 900;
    }
    
    .hero-highlight {
      color: var(--purple);
      position: relative;
    }
    
    .hero-highlight::after {
      content: "";
      position: absolute;
    
      left: 0;
      right: 0;
      bottom: 1px;
    
      height: 9px;
      background: #ffe18b;
      border-radius: 10px;
      z-index: -1;
    }
    
    .hero-description {
      color: #827b9a;
      font-size: 14px;
      font-weight: 700;
      margin: 22px 0 28px;
      line-height: 2.1;
    }
    
    .hero-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 13px;
    
      background: var(--purple);
      color: white;
    
      padding: 17px 30px;
      border-radius: 17px;
    
      font-size: 16px;
      font-weight: 900;
    
      box-shadow: 0 7px 0 var(--purple-dark);
    
      transition: transform .2s, box-shadow .2s;
    }
    
    .hero-button:hover {
      transform: translateY(3px);
      box-shadow: 0 4px 0 var(--purple-dark);
    }
    
    .button-arrow {
      font-size: 21px;
    }
    
    .hero-features {
      display: flex;
      flex-wrap: wrap;
      gap: 13px;
      margin-top: 25px;
    
      color: #80799a;
      font-size: 11px;
      font-weight: 800;
    }
    
    
    /* ヒーローイラスト */
    
    .hero-visual {
      min-height: 380px;
      position: relative;
    
      display: grid;
      place-items: center;
    
      background:
        radial-gradient(
          circle at 50% 50%,
          #eee5ff 0%,
          #e9e1ff 48%,
          transparent 72%
        );
    }
    
    .hero-math-card {
      width: 330px;
      max-width: 85%;
    
      background: white;
      border: 5px solid white;
      border-radius: 30px;
    
      padding: 24px;
      box-shadow: 0 18px 40px rgba(88, 65, 150, .15);
    
      transform: rotate(-4deg);
      position: relative;
      z-index: 2;
    }
    
    .math-card-top {
      display: flex;
      justify-content: space-between;
    
      color: var(--purple);
      font-size: 11px;
      font-weight: 900;
    }
    
    .hero-equation {
      text-align: center;
      font-size: 52px;
      font-weight: 900;
      margin: 18px 0;
      color: var(--text);
    }
    
    .hero-equation span {
      color: var(--orange);
    }
    
    .hero-equation b {
      color: var(--purple);
    }
    
    .hero-answer {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    
      background: var(--green-light);
      color: #31a77d;
    
      border-radius: 18px;
      padding: 9px;
      font-size: 29px;
      font-weight: 900;
    }
    
    .hero-card-message {
      color: #38a980;
      text-align: center;
      font-size: 13px;
      font-weight: 900;
      margin-top: 13px;
    }
    
    .hero-sun {
      position: absolute;
      top: 12px;
      right: 10%;
      font-size: 55px;
    }
    
    .hero-star {
      position: absolute;
      font-size: 40px;
      color: #ffc94c;
    }
    
    .star-a {
      left: 8%;
      top: 22%;
    }
    
    .star-b {
      right: 10%;
      bottom: 20%;
      color: #ff9ab9;
    }
    
    .hero-floating-badge {
      position: absolute;
      z-index: 3;
    
      background: white;
      border-radius: 30px;
    
      padding: 10px 15px;
      font-size: 11px;
      font-weight: 900;
    
      box-shadow: var(--shadow);
    }
    
    .badge-left {
      left: 0;
      top: 22%;
      transform: rotate(-8deg);
    }
    
    .badge-right {
      right: -5px;
      bottom: 10%;
      transform: rotate(5deg);
    }
    
    
    /* =========================================
       おすすめポイント
    ========================================= */
    
    .point-section {
      max-width: 1160px;
      margin: 0 auto;
      padding: 0 24px 70px;
    
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 18px;
    }
    
    .point-card {
      background: white;
      border-radius: 20px;
      padding: 20px;
    
      display: flex;
      align-items: center;
      gap: 15px;
    
      box-shadow: var(--shadow);
    }
    
    .point-icon {
      width: 55px;
      height: 55px;
      flex-shrink: 0;
    
      border-radius: 17px;
    
      display: grid;
      place-items: center;
      font-size: 27px;
    }
    
    .point-orange .point-icon {
      background: var(--orange-light);
    }
    
    .point-green .point-icon {
      background: var(--green-light);
    }
    
    .point-purple .point-icon {
      background: var(--purple-light);
    }
    
    .point-card div {
      display: flex;
      flex-direction: column;
    }
    
    .point-card strong {
      font-size: 13px;
      font-weight: 900;
    }
    
    .point-card small {
      color: var(--text-light);
      font-size: 10px;
      font-weight: 700;
    }
    
    
    /* =========================================
       セクション共通
    ========================================= */
    
    .section-heading {
      text-align: center;
      margin-bottom: 35px;
    }
    
    .section-kicker {
      display: inline-block;
      color: var(--purple);
      font-size: 11px;
      letter-spacing: 2px;
      font-weight: 900;
    
      background: var(--purple-light);
      padding: 5px 15px;
      border-radius: 30px;
    
      margin-bottom: 12px;
    }
    
    .section-heading h2 {
      font-size: clamp(23px, 3vw, 32px);
      font-weight: 900;
      letter-spacing: -1px;
    }
    
    .section-heading p {
      color: var(--text-light);
      font-size: 13px;
      font-weight: 700;
      margin-top: 7px;
    }
    
    
    /* =========================================
       ドリル設定
    ========================================= */
    
    .challenge-section {
      padding: 80px 24px 95px;
      background: #eee9ff;
    }
    
    .settings-card {
      max-width: 850px;
      margin: auto;
    
      background: white;
      border-radius: 28px;
      overflow: hidden;
    
      box-shadow: 0 18px 50px rgba(81, 57, 145, .1);
    }
    
    .settings-header {
      background: var(--purple);
      color: white;
    
      display: flex;
      align-items: center;
      gap: 15px;
    
      padding: 24px 32px;
      position: relative;
      overflow: hidden;
    }
    
    .settings-header::after {
      content: "✦";
      position: absolute;
      right: 35px;
      top: -30px;
      font-size: 110px;
      opacity: .12;
    }
    
    .settings-header-icon {
      width: 55px;
      height: 55px;
      background: rgba(255,255,255,.18);
      border-radius: 17px;
    
      display: grid;
      place-items: center;
      font-size: 29px;
    }
    
    .settings-header h3 {
      font-size: 20px;
      font-weight: 900;
    }
    
    .settings-header p {
      font-size: 11px;
      opacity: .8;
    }
    
    .settings-decoration {
      margin-left: auto;
      font-size: 35px;
      color: #ffdc62;
    }
    
    .settings-body {
      padding: 32px;
    }
    
    .setting-group {
      margin-bottom: 33px;
    }
    
    .setting-label {
      display: flex;
      align-items: center;
      gap: 12px;
    
      margin-bottom: 17px;
    
      font-size: 15px;
      font-weight: 900;
    }
    
    .setting-number {
      width: 29px;
      height: 29px;
    
      background: var(--purple-light);
      color: var(--purple);
    
      border-radius: 10px;
    
      display: grid;
      place-items: center;
    
      font-size: 11px;
      font-weight: 900;
    }
    
    
    /* セレクトボックス */
    
    .custom-select {
      width: 100%;
      padding: 15px 17px;
    
      border: 2px solid #eae5f6;
      border-radius: 14px;
    
      color: var(--text);
      background: #fcfbff;
    
      font-size: 14px;
      font-weight: 800;
    
      outline: none;
      cursor: pointer;
    }
    
    .custom-select:focus,
    .sound-select:focus {
      border-color: var(--purple);
    }
    
    
    /* 問題数 */
    
    .choice-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 10px;
    }
    
    .choice-card {
      position: relative;
      cursor: pointer;
    
      border: 2px solid #eeeaf7;
      background: #fcfbff;
    
      border-radius: 15px;
      padding: 13px 5px;
    
      display: flex;
      flex-direction: column;
      align-items: center;
    
      transition: .2s;
    }
    
    .choice-card:hover {
      border-color: #c6b5ff;
      transform: translateY(-2px);
    }
    
    .choice-card input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
    
    .choice-card:has(input:checked) {
      border-color: var(--purple);
      background: #f3eeff;
      box-shadow: 0 3px 0 rgba(118,86,219,.12);
    }
    
    .choice-card span {
      font-size: 17px;
      font-weight: 900;
      color: var(--purple);
    }
    
    .choice-card small {
      color: var(--text-light);
      font-size: 9px;
      font-weight: 700;
    }
    
    
    /* 回答モード */
    
    .mode-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
    }
    
    .mode-card {
      position: relative;
      cursor: pointer;
    
      border: 2px solid #eeeaf7;
      border-radius: 17px;
    
      background: white;
      padding: 19px 10px;
    
      display: flex;
      flex-direction: column;
      align-items: center;
    
      text-align: center;
      transition: .2s;
    }
    
    .mode-card:hover {
      transform: translateY(-3px);
    }
    
    .mode-card input {
      position: absolute;
      opacity: 0;
    }
    
    .mode-card:has(input:checked) {
      border-color: var(--purple);
      background: #f6f2ff;
    }
    
    .mode-icon {
      font-size: 30px;
      margin-bottom: 6px;
    }
    
    .mode-card strong {
      font-size: 12px;
      font-weight: 900;
    }
    
    .mode-card small {
      font-size: 9px;
      color: var(--text-light);
      margin-top: 4px;
    }
    
    
    /* オプション */
    
    .option-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }
    
    .option-card {
      border: 1px solid #eeeaf7;
      background: #fcfbff;
      border-radius: 15px;
    
      padding: 15px;
    
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    
    .option-info {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .option-icon {
      font-size: 24px;
    }
    
    .option-info div {
      display: flex;
      flex-direction: column;
    }
    
    .option-info strong {
      font-size: 11px;
      font-weight: 900;
    }
    
    .option-info small {
      color: var(--text-light);
      font-size: 9px;
    }
    
    
    /* トグルスイッチ */
    
    .toggle-switch {
      width: 45px;
      height: 25px;
      position: relative;
      flex-shrink: 0;
    }
    
    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    
    .toggle-slider {
      position: absolute;
      inset: 0;
    
      background: #d8d4e2;
      border-radius: 30px;
    
      cursor: pointer;
      transition: .2s;
    }
    
    .toggle-slider::before {
      content: "";
    
      position: absolute;
      width: 19px;
      height: 19px;
    
      left: 3px;
      top: 3px;
    
      border-radius: 50%;
      background: white;
    
      transition: .2s;
    }
    
    .toggle-switch input:checked + .toggle-slider {
      background: var(--green);
    }
    
    .toggle-switch input:checked + .toggle-slider::before {
      transform: translateX(20px);
    }
    
    .sound-select {
      border: 2px solid #eeeaf7;
      background: white;
      border-radius: 10px;
    
      padding: 7px 9px;
      font-size: 11px;
      font-weight: 800;
    
      color: var(--text);
      outline: none;
      cursor: pointer;
    }
    
    
    /* スタートボタン */
    
    .start-area {
      text-align: center;
      padding: 25px 0 5px;
    
      border-top: 1px dashed #e9e3f6;
    }
    
    .start-area p {
      font-size: 12px;
      color: var(--text-light);
      font-weight: 800;
      margin-bottom: 17px;
    }
    
    .start-button {
      width: min(100%, 370px);
    
      padding: 17px 22px;
    
      background: var(--orange);
      color: white;
    
      border: none;
      border-radius: 17px;
    
      font-size: 17px;
      font-weight: 900;
    
      box-shadow: 0 6px 0 #df7540;
    
      transition: .2s;
    }
    
    .start-button:hover {
      transform: translateY(3px);
      box-shadow: 0 3px 0 #df7540;
    }
    
    .start-arrow {
      margin-left: 10px;
    }
    
    .start-note {
      font-size: 10px;
      color: #b0a9c3;
      margin-top: 16px;
      font-weight: 700;
    }

    .start-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      justify-content: center;
      align-items: stretch;
    }

    /* 算数プリントへの副ボタン（先生・保護者向け、主ボタンより控えめに） */

    .print-link-button {
      display: inline-flex;
      align-items: center;
      gap: 7px;

      padding: 12px 18px;

      background: white;
      color: var(--purple-dark);

      border: 2px solid var(--purple);
      border-radius: 17px;

      font-size: 14px;
      font-weight: 800;
      text-decoration: none;

      transition: .2s;
    }

    .print-link-button small {
      font-size: 11px;
      font-weight: 700;
      color: var(--purple);
      background: var(--purple-light);
      border-radius: 999px;
      padding: 2px 8px;
    }

    .print-link-button:hover {
      background: var(--purple-light);
    }
    
    
    /* =========================================
       問題エリア
    ========================================= */
    
    .game-section {
      padding: 90px 24px;
    }
    
    .game-card {
      max-width: 760px;
      margin: auto;
    
      background: white;
      border-radius: 27px;
    
      box-shadow: var(--shadow);
      overflow: hidden;
    
      padding: 28px;
    }
    
    .game-topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    
    .game-level {
      background: #fff2d1;
      color: #a87b19;
    
      border-radius: 30px;
      padding: 7px 14px;
    
      font-size: 11px;
      font-weight: 900;
    }
    
    .game-status {
      color: var(--purple);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 1.5px;
    }
    
    
    /* 進捗 */
    
    .game-progress-area {
      margin-top: 25px;
    }
    
    .progress-label {
      display: flex;
      justify-content: space-between;
    
      font-size: 11px;
      font-weight: 800;
    
      margin-bottom: 9px;
    }
    
    .progress-label strong {
      color: var(--purple);
    }
    
    .progress-track {
      height: 11px;
      border-radius: 20px;
      background: #eeeaf6;
      overflow: hidden;
    }
    
    .progress-value {
      width: 30%;
      height: 100%;
    
      border-radius: 20px;
    
      background:
        linear-gradient(
          90deg,
          #9a83f1,
          #7453dc
        );
    }
    
    
    /* ステータス */
    
    .game-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
    
      margin-top: 25px;
    }
    
    .stat-box {
      background: #f8f6fc;
      border-radius: 15px;
    
      padding: 13px 5px;
    
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .stat-box > span {
      font-size: 19px;
    }
    
    .stat-box small {
      color: var(--text-light);
      font-size: 9px;
      font-weight: 800;
    }
    
    .stat-box strong {
      font-size: 20px;
      font-weight: 900;
    }
    
    .stat-box strong span {
      font-size: 10px;
      margin-left: 2px;
    }
    
    .stat-score {
      background: #fff5d9;
    }
    
    .stat-score strong {
      color: #d39c23;
    }
    
    
    /* 問題 */
    
    .question-area {
      background: #f2edff;
      border-radius: 23px;
    
      padding: 28px 20px;
      margin-top: 25px;
    
      text-align: center;
      position: relative;
      overflow: hidden;
    }
    
    .question-number {
      position: absolute;
      top: 15px;
      left: 17px;
    
      display: flex;
      align-items: center;
      gap: 7px;
    
      color: var(--purple);
    }
    
    .question-number span {
      font-size: 9px;
      letter-spacing: 1px;
      font-weight: 900;
    }
    
    .question-number strong {
      font-size: 15px;
    }
    
    .question-character {
      font-size: 28px;
      margin-bottom: 4px;
    }
    
    .question-text {
      font-size: clamp(44px, 7vw, 64px);
      font-weight: 900;
      line-height: 1.4;
    }
    
    .question-text span {
      color: var(--orange);
    }
    
    .question-text b {
      color: var(--purple);
    }
    
    .question-hint {
      color: #8f85ad;
      font-size: 11px;
      font-weight: 800;
      margin-top: 7px;
    }
    
    
    /* 回答 */
    
    .answer-area {
      padding: 25px 0;
      text-align: center;
    }
    
    .answer-area h3 {
      font-size: 14px;
      font-weight: 900;
      margin-bottom: 15px;
    }
    
    .free-answer {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
    }
    
    .free-answer input {
      width: 150px;
      height: 58px;
    
      border: 3px solid #e6defb;
      border-radius: 14px;
    
      background: #fcfbff;
    
      text-align: center;
      font-size: 25px;
      font-weight: 900;
      color: var(--purple);
    
      outline: none;
    }
    
    .free-answer input:focus {
      border-color: var(--purple);
    }
    
    .free-answer > span {
      font-size: 12px;
      font-weight: 900;
    }
    
    
    /* 4択 */
    
    .choice-answer {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
    
      margin-top: 18px;
    }
    
    .choice-answer button {
      background: white;
      border: 2px solid #eae5f5;
      border-radius: 14px;
    
      padding: 13px 5px;
    
      font-size: 15px;
      font-weight: 900;
    
      color: var(--text);
      transition: .2s;
    }
    
    .choice-answer button:hover,
    .choice-answer .selected-answer {
      border-color: var(--purple);
      background: #f2edff;
      color: var(--purple);
    }
    
    
    /* 回答ボタン */
    
    .answer-button {
      width: min(100%, 320px);
      margin-top: 23px;
    
      padding: 15px;
    
      border: none;
      border-radius: 15px;
    
      background: var(--green);
      color: white;
    
      font-size: 16px;
      font-weight: 900;
    
      box-shadow: 0 5px 0 #3aa77e;
    
      transition: .2s;
    }
    
    .answer-button:hover {
      transform: translateY(3px);
      box-shadow: 0 2px 0 #3aa77e;
    }
    
    
    /* フィードバック */
    
    .feedback-box {
      display: flex;
      align-items: center;
      gap: 15px;
    
      padding: 17px;
    
      border-radius: 16px;
      background: #e7f9ef;
    
      border: 1px solid #c8efda;
    }
    
    .feedback-icon {
      font-size: 34px;
    }
    
    .feedback-content {
      flex: 1;
    }
    
    .feedback-content strong {
      font-size: 13px;
      color: #299a70;
      font-weight: 900;
    }
    
    .feedback-content p {
      color: #57977e;
      font-size: 10px;
      font-weight: 700;
    }
    
    .feedback-stars {
      font-size: 15px;
    }
    
    .next-question {
      text-align: center;
      margin-top: 18px;
    }
    
    .next-question button {
      background: var(--purple);
      color: white;
    
      border: none;
      border-radius: 30px;
    
      padding: 12px 30px;
    
      font-size: 12px;
      font-weight: 900;
    }
    
    
    /* =========================================
       結果エリア
    ========================================= */
    
    .result-section {
      padding: 85px 24px;
      background: #fff5dc;
    }
    
    .result-card {
      max-width: 570px;
      margin: auto;
    
      background: white;
      border-radius: 30px;
    
      padding: 35px 35px 30px;
    
      text-align: center;
    
      box-shadow: 0 15px 40px rgba(168, 126, 44, .12);
    
      position: relative;
      overflow: hidden;
    }
    
    .result-confetti {
      color: #f3c04f;
      font-size: 22px;
      letter-spacing: 9px;
      margin-bottom: 10px;
    }
    
    .result-trophy {
      font-size: 74px;
      line-height: 1.5;
    
      filter: drop-shadow(0 5px 5px rgba(200,150,40,.15));
    }
    
    .result-message span {
      color: #e5a633;
      font-size: 10px;
      letter-spacing: 2px;
      font-weight: 900;
    }
    
    .result-message h3 {
      font-size: 22px;
      font-weight: 900;
      margin-top: 5px;
    }
    
    .result-score {
      margin: 25px auto;
      padding: 20px;
    
      max-width: 260px;
    
      background: #fff6df;
      border-radius: 20px;
    }
    
    .result-score small {
      color: #a88a49;
      font-size: 11px;
      font-weight: 900;
    }
    
    .score-number {
      color: #e7a936;
      font-size: 63px;
      line-height: 1.4;
      font-weight: 900;
    }
    
    .score-number span {
      font-size: 20px;
      margin-left: 5px;
    }
    
    .score-detail {
      font-size: 11px;
      color: #ad935d;
      font-weight: 800;
    }
    
    
    /* 称号 */
    
    .result-rank {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 16px;
    
      background: #f1ebff;
      border-radius: 17px;
    
      padding: 17px;
      margin-bottom: 22px;
    
      text-align: left;
    }
    
    .rank-icon {
      font-size: 40px;
    }
    
    .result-rank div {
      display: flex;
      flex-direction: column;
    }
    
    .result-rank small {
      font-size: 9px;
      color: #9788c0;
      font-weight: 800;
    }
    
    .result-rank strong {
      color: var(--purple);
      font-size: 19px;
      font-weight: 900;
    }
    
    .result-rank p {
      font-size: 10px;
      color: #89809f;
    }
    
    
    /* 結果の内訳 */
    
    .result-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    
      margin-bottom: 25px;
    }
    
    .result-stats div {
      display: flex;
      flex-direction: column;
      align-items: center;
    
      padding: 12px 5px;
    
      background: #faf9fc;
      border-radius: 13px;
    }
    
    .result-stats span {
      font-size: 20px;
    }
    
    .result-stats strong {
      font-size: 15px;
      font-weight: 900;
    }
    
    .result-stats small {
      font-size: 9px;
      color: var(--text-light);
      font-weight: 700;
    }
    
    
    /* もう一度 */
    
    .retry-button {
      width: 100%;
      padding: 16px;
    
      border: none;
      border-radius: 16px;
    
      background: var(--orange);
      color: white;
    
      font-size: 15px;
      font-weight: 900;
    
      box-shadow: 0 5px 0 #df7540;
    
      transition: .2s;
    }
    
    .retry-button:hover {
      transform: translateY(3px);
      box-shadow: 0 2px 0 #df7540;
    }
    
    .result-encourage {
      color: #b09a6a;
      font-size: 11px;
      font-weight: 800;
      margin-top: 18px;
    }
    
    
    /* =========================================
       印刷エリア
    ========================================= */
    
    .print-section {
      padding: 65px 24px;
    }
    
    .print-card {
      max-width: 900px;
      margin: auto;
    
      background: white;
      border: 2px dashed #d9cff7;
    
      border-radius: 23px;
      padding: 25px 30px;
    
      display: flex;
      align-items: center;
      gap: 20px;
    }
    
    .print-icon {
      width: 65px;
      height: 65px;
      flex-shrink: 0;
    
      border-radius: 20px;
      background: #eee9ff;
    
      display: grid;
      place-items: center;
    
      font-size: 30px;
    }
    
    .print-content {
      flex: 1;
    }
    
    .print-content h3 {
      font-size: 15px;
      font-weight: 900;
    }
    
    .print-content p {
      color: var(--text-light);
      font-size: 11px;
      font-weight: 700;
    }
    
    .print-button {
      background: #fff1df;
      color: #b97a34;
    
      border: none;
      border-radius: 14px;
    
      padding: 13px 18px;
    
      font-size: 11px;
      font-weight: 900;
    
      white-space: nowrap;
      transition: .2s;
    }
    
    .print-button:hover {
      background: #ffe5c5;
    }
    
    .print-only {
      display: none;
    }
    
    
    /* =========================================
       使い方
    ========================================= */
    
    .howto-section {
      padding: 85px 24px;
      background: #f0edff;
    }
    
    .howto-grid {
      max-width: 1000px;
      margin: auto;
    
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 18px;
    }
    
    .howto-card {
      background: white;
      border-radius: 22px;
      padding: 25px;
    
      text-align: center;
    
      box-shadow: var(--shadow);
    }
    
    .howto-number {
      color: #aaa0c6;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 2px;
    }
    
    .howto-icon {
      width: 85px;
      height: 85px;
    
      margin: 15px auto;
    
      display: grid;
      place-items: center;
    
      border-radius: 28px;
    
      font-size: 42px;
    }
    
    .howto-purple {
      background: #eee8ff;
    }
    
    .howto-orange {
      background: #fff0e4;
    }
    
    .howto-green {
      background: #e4f9ed;
    }
    
    .howto-card h3 {
      font-size: 15px;
      font-weight: 900;
      margin-bottom: 9px;
    }
    
    .howto-card p {
      color: var(--text-light);
      font-size: 11px;
      line-height: 2;
      font-weight: 700;
    }
    
    .howto-message {
      max-width: 750px;
      margin: 35px auto 0;

      background: #fff5d8;
      border-radius: 50px;

      padding: 15px 25px;

      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;

      color: #997527;
      font-size: 12px;
      font-weight: 900;
    }


    /* =========================================
       使い方ガイド
    ========================================= */

    .guide-section {
      padding: 85px 24px;
      background: #ffffff;
    }

    .guide-grid {
      max-width: 1000px;
      margin: auto;

      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 18px;
    }

    .guide-card {
      background: #f7f4ff;
      border-radius: 22px;
      padding: 25px;

      box-shadow: var(--shadow);
    }

    .guide-card h3 {
      font-size: 16px;
      font-weight: 900;
      margin-bottom: 10px;
    }

    .guide-card p {
      color: var(--text-light);
      font-size: 12.5px;
      line-height: 2;
      font-weight: 700;
    }

    .guide-card p + p {
      margin-top: 8px;
    }

    .guide-audience {
      max-width: 1000px;
      margin: 55px auto 20px;

      font-size: 19px;
      font-weight: 900;
      text-align: center;
    }

    .guide-audience-lead {
      max-width: 900px;
      margin: 0 auto 20px;

      color: var(--text);
      font-size: 13.5px;
      line-height: 1.9;
      font-weight: 500;
      text-align: center;
    }

    .guide-docs {
      max-width: 900px;
      margin: auto;
    }

    .guide-doc {
      background: #faf9ff;
      border-radius: 22px;
      padding: 28px;
      margin-bottom: 18px;

      box-shadow: var(--shadow);
    }

    .guide-doc h3 {
      font-size: 17px;
      font-weight: 900;
      margin-bottom: 12px;
    }

    .guide-doc h4 {
      color: var(--purple);
      font-size: 14px;
      font-weight: 900;
      margin: 18px 0 6px;
    }

    .guide-doc p {
      color: var(--text);
      font-size: 13.5px;
      line-height: 1.9;
      font-weight: 500;
    }

    .guide-doc p + p {
      margin-top: 8px;
    }

    
    /* =========================================
       最後のCTA
    ========================================= */
    
    .bottom-cta {
      background: var(--purple);
      color: white;
    
      text-align: center;
    
      padding: 70px 24px;
    
      position: relative;
      overflow: hidden;
    }
    
    .bottom-cta > span {
      color: #e3d9ff;
      font-size: 10px;
      letter-spacing: 3px;
      font-weight: 900;
    }
    
    .bottom-cta h2 {
      font-size: clamp(24px, 4vw, 36px);
      font-weight: 900;
      margin: 12px 0;
    }
    
    .bottom-cta p {
      color: #e4dcff;
      font-size: 12px;
      font-weight: 700;
      margin-bottom: 25px;
    }
    
    .bottom-cta-button {
      display: inline-block;
    
      background: var(--yellow);
      color: #77551b;
    
      padding: 15px 30px;
    
      border-radius: 15px;
    
      font-size: 14px;
      font-weight: 900;
    
      box-shadow: 0 5px 0 #c69b37;
      transition: .2s;
    }
    
    .bottom-cta-button:hover {
      transform: translateY(3px);
      box-shadow: 0 2px 0 #c69b37;
    }
    
    .bottom-cta-decoration {
      position: absolute;
      font-size: 65px;
      color: #fff;
      opacity: .13;
    }
    
    .bottom-cta-decoration:nth-of-type(1) {
      top: 20px;
      left: 10%;
    }
    
    .bottom-cta-decoration:nth-of-type(2) {
      bottom: 20px;
      right: 10%;
    }
    
    
    /* =========================================
       フッター
    ========================================= */
    
    .site-footer {
      background: #37304f;
      color: white;
    }
    
    .footer-inner {
      max-width: 1100px;
      margin: auto;
      padding: 35px 24px;
    
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      flex-wrap: wrap;
    }
    
    .footer-brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    
    .footer-brand > span {
      font-size: 30px;
    }
    
    .footer-brand div {
      display: flex;
      flex-direction: column;
    }
    
    .footer-brand strong {
      font-size: 15px;
      font-weight: 900;
    }
    
    .footer-brand small {
      color: #b9b2ca;
      font-size: 10px;
    }
    
    .footer-links {
      display: flex;
      gap: 20px;
    }
    
    .footer-links a {
      color: #d1c9e4;
      font-size: 11px;
      font-weight: 700;
      transition: .2s;
    }
    
    .footer-links a:hover {
      color: white;
      text-decoration: underline;
    }
    
    .copyright {
      width: 100%;
      text-align: center;
    
      padding-top: 20px;
      border-top: 1px solid rgba(255,255,255,.12);
    
      color: #a9a2bb;
      font-size: 10px;
    }
    
    
    /* =========================================
       レスポンシブ
    ========================================= */

    @media (max-width: 1024px) {

      .header-nav {
        gap: 20px;
      }

    }

    @media (max-width: 768px) {
    
      .header-inner {
        padding: 12px 17px;
        flex-wrap: wrap;
        row-gap: 8px;
      }

      .header-nav {
        display: flex;
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        gap: 6px 14px;
        font-size: 12px;
      }

      .header-nav a {
        white-space: nowrap;
      }

      .header-badge {
        display: none;
      }
    
      .hero {
        padding: 55px 22px 50px;
        grid-template-columns: 1fr;
        gap: 25px;
      }
    
      .hero-content {
        text-align: center;
      }
    
      .hero h1 {
        font-size: 43px;
      }
    
      .hero-description {
        font-size: 12px;
      }
    
      .hero-features {
        justify-content: center;
      }
    
      .hero-visual {
        min-height: 330px;
      }
    
      .hero-math-card {
        width: 290px;
      }
    
      .point-section {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-bottom: 55px;
      }
    
      .point-card {
        padding: 15px 20px;
      }
    
      .challenge-section,
      .game-section,
      .result-section,
      .howto-section {
        padding: 65px 17px;
      }
    
      .settings-body {
        padding: 23px 17px;
      }
    
      .settings-header {
        padding: 20px;
      }
    
      .settings-header h3 {
        font-size: 17px;
      }
    
      .choice-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
      }
    
      .choice-card {
        padding: 12px 2px;
      }
    
      .choice-card span {
        font-size: 14px;
      }
    
      .choice-card small {
        font-size: 8px;
      }
    
      .mode-grid {
        gap: 7px;
      }
    
      .mode-card {
        padding: 14px 5px;
      }
    
      .mode-card strong {
        font-size: 10px;
      }
    
      .mode-card small {
        font-size: 8px;
      }
    
      .option-grid {
        grid-template-columns: 1fr;
      }
    
      .game-card {
        padding: 20px 15px;
      }
    
      .question-area {
        padding: 35px 10px 25px;
      }
    
      .question-text {
        font-size: 48px;
      }
    
      .game-stats {
        gap: 7px;
      }
    
      .stat-box {
        padding: 10px 3px;
      }
    
      .stat-box strong {
        font-size: 16px;
      }
    
      .feedback-box {
        gap: 8px;
        padding: 13px 9px;
      }
    
      .feedback-stars {
        font-size: 11px;
      }
    
      .howto-grid {
        grid-template-columns: 1fr;
        max-width: 450px;
      }

      .guide-grid {
        grid-template-columns: 1fr;
        max-width: 450px;
      }

      .guide-doc {
        padding: 22px;
      }
    
      .howto-card {
        padding: 22px;
      }
    
      .print-card {
        flex-wrap: wrap;
        padding: 20px;
      }
    
      .print-content {
        min-width: 180px;
      }
    
      .print-button {
        width: 100%;
      }
    
      .footer-inner {
        flex-direction: column;
        text-align: center;
      }
    
      .footer-links {
        justify-content: center;
        flex-wrap: wrap;
      }
    
    }
    
    
    @media (max-width: 420px) {
    
      .logo-icon {
        width: 41px;
        height: 41px;
        font-size: 27px;
      }
    
      .logo-text strong {
        font-size: 14px;
      }
    
      .header-badge {
        font-size: 8px;
      }

      .header-nav {
        font-size: 11.5px;
        gap: 5px 12px;
      }

      .hero h1 {
        font-size: 36px;
      }
    
      .hero-features {
        gap: 8px;
        font-size: 9px;
      }
    
      .hero-visual {
        min-height: 290px;
      }
    
      .hero-floating-badge {
        font-size: 9px;
        padding: 8px 10px;
      }
    
      .badge-left {
        left: -5px;
      }
    
      .badge-right {
        right: -5px;
      }
    
      .choice-card span {
        font-size: 12px;
      }
    
      .choice-card small {
        font-size: 7px;
      }
    
      .mode-icon {
        font-size: 24px;
      }
    
      .question-text {
        font-size: 42px;
      }
    
      .result-card {
        padding: 25px 18px;
      }
    
      .result-message h3 {
        font-size: 19px;
      }
    
      .score-number {
        font-size: 55px;
      }
    
    }


/* =========================================
   統合追加分（機能部品をデザイン言語で）
   単元プルダウン／一覧モード／フラッシュ／結果／印刷
========================================= */

:root {
  --ok: #2f9e6e;
  --ok-bg: #e7f9ef;
  --ng: #e05260;
  --ng-bg: #fdeef0;
  --line-soft: #eae5f6;
}

/* ---------- 単元プルダウン（選択中単元の説明） ---------- */

.unit-desc {
  margin-top: 10px;
  padding: 9px 14px;
  background: var(--purple-light);
  color: var(--purple-dark);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.7;
}

/* ---------- 単元カスタムドロップダウン ---------- */

/* 実体の select は同期専用に残し、視覚的には隠す */
.custom-select.unit-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.unit-dd {
  position: relative;
}

.unit-dd-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 17px;
  border: 2px solid #eae5f6;
  border-radius: 14px;
  background: #fcfbff;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.unit-dd-btn:hover {
  border-color: #c6b5ff;
}

.unit-dd-btn:focus-visible {
  outline: 3px solid rgba(118, 86, 219, .35);
  outline-offset: 2px;
}

.unit-dd.open .unit-dd-btn {
  border-color: var(--purple);
  background: white;
}

.unit-dd-grade {
  flex: none;
  background: #fff2d1;
  color: #a87b19;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 900;
}

.unit-dd-name {
  flex: 1;
  min-width: 0;
}

.unit-dd-arrow {
  flex: none;
  color: var(--purple);
  font-size: 13px;
  font-weight: 900;
  transition: transform .2s;
}

.unit-dd.open .unit-dd-arrow {
  transform: rotate(180deg);
}

.unit-dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #eae5f6;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(88, 65, 150, .18);
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 40;
}

.unit-dd-panel[hidden] {
  display: none;
}

.unit-dd.open .unit-dd-panel {
  animation: unitDdIn .16s ease;
}

@keyframes unitDdIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.unit-dd-group-head {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--purple);
}

.unit-dd-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 9px 34px 9px 12px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  position: relative;
}

.unit-dd-item:hover {
  background: #f6f2ff;
}

.unit-dd-item:focus-visible {
  background: #f6f2ff;
  outline: 3px solid rgba(118, 86, 219, .35);
  outline-offset: -3px;
}

.unit-dd-item.sel {
  background: var(--purple-light);
}

.unit-dd-item.sel::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--purple);
  font-weight: 900;
  font-size: 16px;
}

.unit-dd-item-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.unit-dd-item-desc {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.5;
}

/* ---------- ルビ（ふりがな） ---------- */

ruby {
  ruby-align: center;
}

rt {
  font-size: .52em;
  font-weight: 700;
  letter-spacing: 0;
}

/* ルビ表示のときは、ふりがなの分だけ行間を広げて重なりを防ぐ */
body[data-notation="ruby"] .unit-dd-item-title,
body[data-notation="ruby"] .unit-dd-item-desc {
  line-height: 1.9;
}

body[data-notation="ruby"] .qtext,
body[data-notation="ruby"] .question-text {
  line-height: 1.9;
}

body[data-notation="ruby"] .exp {
  line-height: 2.1;
}

/* ---------- ○の図（小1の解説：数図ブロック方式） ---------- */

.maru-line {
  display: block;
  margin: 6px 0;
  line-height: 2;
}

.maru {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #7a5fd0;
  border-radius: 50%;
  background: #fff;
  margin: 0 1px;
  vertical-align: middle;
  box-sizing: border-box;
  position: relative;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.maru.b {
  border-color: #f09a3c;
}

.maru.x {
  background: #e9e5f7;
  border-color: #b9aede;
}

.maru.x::after {
  content: "×";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -56%);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  color: #e05260;
}

.maru.miss {
  border-style: dashed;
  border-color: #b9aede;
  background: transparent;
}

.maru-ten {
  display: inline-block;
  border: 2px solid #f0a13c;
  background: #fff7e8;
  border-radius: 9px;
  padding: 2px 4px;
  margin: 1px 2px;
  vertical-align: middle;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.maru-ten.open {
  border-style: dashed;
  background: #fdf4ec;
}

.maru-group {
  display: inline-block;
  margin: 1px 2px;
  vertical-align: middle;
}

.maru-op {
  font-weight: 900;
  margin: 0 4px;
  vertical-align: middle;
}

/* ---------- 結果カード（JSが中身を生成） ---------- */

.result {
  display: none;
  max-width: 760px;
  margin: 45px auto 0;
  padding: 30px 32px;
  background: white;
  border-radius: 27px;
  box-shadow: var(--shadow);
  text-align: center;
  line-height: 2;
}

.result.show {
  display: block;
}

.result .score {
  font-size: 24px;
  font-weight: 900;
  color: var(--purple-dark);
}

.title-badge {
  display: inline-block;
  background: #f1ebff;
  border: 2px solid #d9cff7;
  color: var(--purple);
  border-radius: 999px;
  padding: 5px 20px;
  font-weight: 900;
  font-size: 17px;
  margin-bottom: 8px;
}

.btn {
  border: 0;
  border-radius: 15px;
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 900;
  font-size: 14px;
  transition: .2s;
}

.btn-main {
  background: var(--orange);
  color: white;
  box-shadow: 0 5px 0 #df7540;
}

.btn-main:hover {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #df7540;
}

.btn-sub {
  background: white;
  border: 2px solid var(--line-soft);
  color: var(--text);
}

.btn:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
}

/* ---------- リザルト画面（採点後のモーダル） ---------- */

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.result-modal[hidden] {
  display: none;
}

.result-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 32, 84, .55);
}

.result-modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: white;
  border-radius: 27px;
  box-shadow: 0 20px 50px rgba(43, 32, 84, .35);
  padding: 28px 26px 24px;
  text-align: center;
  line-height: 1.9;
  animation: levelPop .35s ease;
}

.result-modal-card .result-confetti {
  margin-bottom: 2px;
}

.result-modal-card .result-trophy {
  font-size: 56px;
  line-height: 1.3;
}

.rm-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--purple-dark);
  margin: 2px 0 8px;
}

.rm-body .score {
  font-size: 26px;
  font-weight: 900;
  color: var(--purple-dark);
}

.rm-body .rm-time {
  font-weight: 800;
  color: var(--text-light);
}

.rm-body .unit-results {
  text-align: left;
  margin-top: 14px;
}

.rm-body .ta-wrong {
  text-align: left;
  margin-top: 12px;
  line-height: 1.8;
  font-size: 14px;
  scroll-margin-top: 8px;
}

.rm-body .perfect-note {
  margin-top: 10px;
  font-weight: 900;
  color: var(--purple);
}

/* タイムアタックの解答欄は使い回しの固定要素。hidden の部品（分数バー・余り欄）は確実に隠す */
#fAns [hidden] {
  display: none !important;
}

.rm-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.rm-buttons .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

@media (max-width: 480px) {
  .result-modal { padding: 10px; }
  .result-modal-card { padding: 22px 16px 18px; border-radius: 22px; }
  .rm-body .score { font-size: 22px; }
  .rm-buttons .btn { min-width: 0; flex: 1 1 42%; padding: 12px 8px; font-size: 13px; }
  .rm-buttons .btn-main { flex-basis: 100%; order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .result-modal-card { animation: none; }
}

@media print {
  .result-modal { display: none !important; }
}

/* ---------- 一覧モード ---------- */

.list-card {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 27px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.list-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.timer-chip {
  background: #fff5d9;
  color: #a87b19;
  border-radius: 30px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-chip b {
  font-size: 15px;
}

ol.qs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 26px;
}

ol.qs li {
  padding: 13px 15px;
  border: 2px solid #f0ebfa;
  border-radius: 16px;
  background: #fcfbff;
}

ol.qs li.ok {
  background: var(--ok-bg);
  border-color: #b5e6cd;
}

ol.qs li.ng {
  background: var(--ng-bg);
  border-color: #f6c3c9;
}

.qhead {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qnum {
  color: var(--purple);
  font-size: 12px;
  font-weight: 900;
  width: 22px;
  flex: none;
}

.qtext {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}

input.ans {
  width: 76px;
  padding: 8px;
  border: 2.5px solid #e6defb;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
  background: white;
  color: var(--purple);
  outline: none;
}

input.ans:focus {
  border-color: var(--purple);
}

input.ans.rem {
  width: 58px;
}

input.ans.slot {
  cursor: pointer;
  caret-color: transparent;
}

input.ans.slot.active {
  border-color: var(--yellow);
  background: #fff8dd;
}

.mark {
  font-weight: 900;
  width: 20px;
  flex: none;
  text-align: center;
  font-size: 18px;
}

.mark.ok { color: var(--ok); }
.mark.ng { color: var(--ng); }

.correct {
  font-size: 13px;
  font-weight: 800;
  color: var(--ng);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.choice {
  border: 2px solid #eae5f5;
  background: white;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  min-width: 64px;
  transition: .2s;
}

.choice:hover {
  border-color: var(--purple);
}

.choice.sel {
  border-color: var(--purple);
  background: #f2edff;
  color: var(--purple);
}

.choice:disabled {
  cursor: default;
  opacity: .85;
}

.exp {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1.5px dashed #e5c15c;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.8;
}

.exp.show {
  display: block;
}

.exp b {
  color: #92600a;
}

.grade-row {
  max-width: 900px;
  margin: 20px auto 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.grade-row .answer-button {
  width: auto;
  margin-top: 0;
  padding: 15px 34px;
}

.btn-sub-lg {
  border: 2px solid var(--line-soft);
  background: white;
  color: var(--text);
  border-radius: 15px;
  padding: 15px 26px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.btn-sub-lg:disabled {
  opacity: .45;
  cursor: default;
}

.note {
  max-width: 900px;
  margin: 22px auto 0;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
  line-height: 2;
}

/* ---------- フラッシュ（タイムアタック） ---------- */

.flash {
  display: none;
}

.flash.show {
  display: block;
}

.game-stats.four {
  grid-template-columns: repeat(4, 1fr);
}

.stat-text {
  font-size: 14px !important;
  line-height: 1.5;
}

.free-answer input.ans {
  width: 124px;
  height: 60px;
  font-size: 27px;
  border-radius: 14px;
}

.free-answer input.ans.rem {
  width: 90px;
}

.f-rem {
  font-size: 14px;
  font-weight: 900;
  color: var(--text-light);
}

.f-judge {
  font-size: 62px;
  font-weight: 900;
  height: 76px;
  line-height: 76px;
  text-align: center;
}

.f-judge.ok { color: var(--ok); }
.f-judge.ng { color: var(--ng); }

.f-correct {
  font-size: 14px;
  font-weight: 800;
  color: var(--ng);
  height: 24px;
  text-align: center;
}

.f-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 340px;
  margin: 14px auto 0;
}

/* 「あまり」キーは最下段の帯として横幅いっぱいに広げる（電卓式配置） */
.f-pad button[data-key="あまり"] {
  grid-column: 1 / -1;
}

.f-pad button {
  border: 2px solid #eae5f5;
  background: #fcfbff;
  border-radius: 14px;
  padding: 13px 0;
  font-size: 19px;
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  /* ゾロ目（77等）の連打でもダブルタップズームさせない（2026-11-28）。
     キーはスクロールも選択も不要なので none で完全に握る */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.f-pad button:active {
  background: #f2edff;
  border-color: var(--purple);
}

.f-pad button.fn {
  font-size: 13px;
  background: #f1eef9;
}

/* タッチデバイスでもタイムアタックのパッドは使う（2026-11-26 ぶに方針転換：
   TAに限ってスマホでも自作パッドで入力する。以前は端末キーボード前提で隠していた）。
   パッドの表示/非表示は JS（fSyncInputMode）が実行状態に合わせて切り替える。
   ここでは指で押しやすい大きさだけを担保する */
@media (pointer: coarse) {
  .f-pad { gap: 10px; }
  .f-pad button { min-height: 54px; padding: 15px 0; font-size: 21px; }
  .f-pad button.fn { font-size: 15px; }
}

.flash-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.flash-buttons .answer-button {
  width: auto;
  margin-top: 0;
  padding: 15px 38px;
}

.quit-button {
  border: 2px solid var(--line-soft);
  background: white;
  color: var(--text);
  border-radius: 15px;
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

/* ---------- 印刷（画面では隠す） ---------- */

.print-head,
.print-answers {
  display: none;
}

/* ---------- 統合レスポンシブ ---------- */

@media (max-width: 768px) {
  .game-stats.four {
    grid-template-columns: 1fr 1fr;
  }

  .list-card {
    padding: 20px 15px;
  }

  .result {
    margin: 35px 17px 0;
    padding: 24px 18px;
  }

  .note {
    margin: 22px 17px 0;
  }

  .grade-row {
    margin: 20px 17px 0;
  }
}

@media (max-width: 640px) {
  ol.qs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .free-answer input.ans {
    width: 104px;
    font-size: 24px;
  }

  .free-answer input.ans.rem {
    width: 78px;
  }
}


/* =========================================
   印刷用スタイル（動的印刷：問題リスト＋答え）
========================================= */

@media print {

  body {
    background: white;
    color: black;
    font-family: sans-serif;
  }

  .no-print,
  .flash,
  .result,
  .grade-row,
  .background-decoration {
    display: none !important;
  }

  .game-section {
    padding: 0;
  }

  .list-card {
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    padding: 0;
  }

  .print-head {
    display: block;
    margin-bottom: 14px;
  }

  .print-head #printTitle {
    font-size: 18px;
    font-weight: 700;
  }

  .print-head .nm {
    border-bottom: 1px solid #999;
    padding-bottom: 6px;
    margin-top: 10px;
    font-size: 14px;
  }

  ol.qs {
    grid-template-columns: 1fr 1fr;
    gap: 16px 30px;
  }

  ol.qs li {
    border: 0;
    padding: 6px 0;
    background: #fff !important;
  }

  input.ans {
    border: 0;
    border-bottom: 1.5px solid #999;
    border-radius: 0;
    background: transparent;
    color: black;
  }

  .mark,
  .correct,
  .choices,
  .exp {
    display: none !important;
  }

  .print-answers {
    display: block;
    page-break-before: always;
    font-size: 14px;
    line-height: 2;
  }

  /* ルビつきで印刷するときは、ふりがなが重ならないよう行間を確保する */
  body[data-notation="ruby"] .qtext {
    line-height: 2.1;
  }

  rt {
    font-size: .5em;
  }

}

/* ---------- 分数の表示・入力（小4〜小6単元） ---------- */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1.15;
  margin: 0 2px;
}

.frac .frac-num {
  border-bottom: 2px solid currentColor;
  padding: 0 5px;
}

.frac .frac-den {
  padding: 0 5px;
}

.choice .frac {
  font-size: 14px;
}

.frac-in {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  vertical-align: middle;
  gap: 3px;
}

.frac-in input.ans {
  width: 72px;
  padding: 5px 6px;
  font-size: 15px;
}

.frac-in .frac-in-bar {
  height: 2.5px;
  background: var(--purple);
  border-radius: 2px;
}

.frac-in.flash input.ans {
  width: 100px;
  height: 50px;
  font-size: 22px;
}

.free-answer .frac-in {
  margin: 0 auto;
}

/* 文章問題：長い文を読みやすい大きさで折り返す */
#qs li.word-q .qtext {
  white-space: normal;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
  text-align: left;
}

/* ---------- 実力テスト・テスト作成（混合出題） ---------- */
.choice-grid.grade-grid {
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 14px;
}

.choice-grid.term-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 12px;
}

.choice-grid.notation-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 480px;
  margin-bottom: 8px;
}

.build-sub {
  font-weight: 900;
  font-size: 13px;
  color: var(--purple);
  margin: 10px 0 8px;
}

.build-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted, #6b6480);
  margin: 6px 0 10px;
}

.build-preset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}

.build-preset .build-sel {
  flex: 1 1 140px;
  width: auto;
}

.build-group {
  margin-bottom: 10px;
}

.build-group-head {
  padding: 10px 4px 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--purple);
}

.build-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 2px solid #eae5f6;
  border-radius: 12px;
  background: #fcfbff;
  margin-bottom: 6px;
}

.build-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.build-check-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
  flex: none;
}

.build-unit-name {
  font-size: 13px;
  font-weight: 800;
}

.build-count-wrap {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.build-count {
  width: 62px;
  padding: 7px 8px;
  border: 2px solid #eae5f6;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  background: #fff;
  outline: none;
}

.build-count:focus {
  border-color: var(--purple);
}

.build-total {
  font-size: 15px;
  font-weight: 900;
  text-align: right;
  margin: 8px 0 12px;
}

.build-total b {
  color: var(--purple);
  font-size: 19px;
}

.build-make {
  width: 100%;
}

#qs li.build-empty {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
  padding: 22px 10px;
}

/* 実力テスト結果：単元ごとの正答率 */
.unit-results {
  margin-top: 16px;
  text-align: left;
}

.unit-results > b {
  display: block;
  margin-bottom: 8px;
}

.unit-result {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 10px;
  border: 2px solid #eae5f6;
  border-radius: 12px;
  background: #fcfbff;
  margin-bottom: 6px;
}

.unit-result-name {
  font-size: 13px;
  font-weight: 800;
  flex: 1 1 180px;
}

.unit-result-bar {
  flex: 1 1 120px;
  height: 10px;
  border-radius: 6px;
  background: #eae5f6;
  overflow: hidden;
}

.unit-result-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--purple);
}

.unit-result.weak .unit-result-fill {
  background: #f59e0b;
}

.unit-result-score {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.unit-practice {
  font-size: 12px;
  padding: 6px 10px;
}

/* テスト系コーナーで使わないモードカードを淡く表示 */
#modeSeg.no-ta [data-mode="ta"],
#modeSeg.free-only [data-mode="choice"] {
  opacity: .45;
}

@media (max-width: 640px) {
  .choice-grid.grade-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .build-row {
    flex-wrap: wrap;
  }
}

/* ---------- 今日の冒険（毎日の動線：5分チャレンジ・復習帳・今日のおすすめ） ---------- */
.today-section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2px 24px 30px;
}

.today-head {
  text-align: center;
  margin-bottom: 16px;
}

.today-head h2 {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 900;
  letter-spacing: -.5px;
}

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

.today-card {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.today-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.today-challenge .today-icon {
  background: var(--orange-light);
}

.today-review .today-icon {
  background: var(--green-light);
}

.today-recommend .today-icon {
  background: var(--purple-light);
}

.today-top strong {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.45;
}

.today-note {
  color: var(--text-light);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.55;
  display: block;
}

.today-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.today-controls .btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
}

.today-controls .sound-select {
  max-width: 108px;
  font-size: 12.5px;
  padding: 8px 6px;
}

@media (max-width: 640px) {
  .today-section {
    padding: 0 14px 22px;
  }

  .today-head {
    margin-bottom: 11px;
  }

  .today-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .today-card {
    padding: 10px 13px;
    gap: 6px;
  }

  .today-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
    border-radius: 11px;
  }
}

/* ---------- 学習サイクル（学習記録・スタンプ・つまずきヒント） ---------- */
.record-section {
  padding: 80px 24px 95px;
  background: #e9f7f1;
}

.record-card {
  max-width: 850px;
  margin: auto;
  background: white;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  padding: 30px 32px;
}

.rec-block {
  margin-top: 20px;
}

.rec-block h4 {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 10px;
}

.stamp-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stamp {
  flex: 1 1 140px;
  max-width: 190px;
  border: 2px solid #eae5f6;
  border-radius: 14px;
  background: #fcfbff;
  padding: 10px 12px;
  text-align: center;
  opacity: .5;
  filter: grayscale(1);
  line-height: 1.5;
}

.stamp.got {
  opacity: 1;
  filter: none;
  background: #fff8e6;
  border-color: #e5c15c;
}

.stamp-icon {
  display: block;
  font-size: 24px;
}

.stamp-name {
  display: block;
  font-size: 12.5px;
  font-weight: 900;
}

.stamp small {
  display: block;
  color: var(--text-light);
  font-size: 10.5px;
  font-weight: 700;
}

.stamp-gain {
  margin-top: 14px;
  padding: 12px;
  background: #fff8e6;
  border: 2px solid #e5c15c;
  border-radius: 14px;
  font-weight: 900;
  line-height: 1.9;
}

.stamp-gain-item {
  display: inline-block;
  background: white;
  border: 1.5px solid #e5c15c;
  border-radius: 999px;
  padding: 2px 12px;
  margin: 2px;
  font-size: 13px;
}

.rec-day {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1.5px dashed #eae5f6;
  font-size: 13.5px;
}

.rec-summary {
  margin-top: 18px;
  font-weight: 800;
  font-size: 14px;
}

.record-card .build-note {
  margin-top: 14px;
}

.record-card #btnRecReset {
  margin-top: 10px;
  font-size: 12px;
  padding: 8px 14px;
}

/* つまずきヒント（解説の中に添える） */
.exp .hint {
  margin-top: 8px;
  padding: 8px 10px;
  background: white;
  border: 1.5px solid #ffd9a0;
  border-radius: 10px;
  color: #7a4d08;
}

@media (max-width: 640px) {
  .record-card {
    padding: 22px 18px;
  }
}

/* ---------- トップへ戻るボタン ---------- */
.to-top {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(88, 65, 150, .35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
}

.to-top.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--purple-dark);
}

.to-top:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .to-top {
    transition: none;
  }
}

/* ---------- レベル・パス報酬・ポイント交換 ---------- */
/* フレームテーマ：マイレコードで選んだフレームが CSS 変数経由でページ全体に反映される */
body[data-frame="sky"] {
  --purple: #2f8fd0; --purple-dark: #1d6ea8; --purple-light: #e3f2fd; --background: #f2f9ff;
}
body[data-frame="sunset"] {
  --purple: #ef7d54; --purple-dark: #c85a2e; --purple-light: #ffeee3; --background: #fff7f0;
}
body[data-frame="forest"] {
  --purple: #3d9e63; --purple-dark: #2a7a49; --purple-light: #e4f6ea; --background: #f3fbf5;
}
body[data-frame="night"] {
  --purple: #5a54b8; --purple-dark: #403a8f; --purple-light: #e6e4ff; --background: #efefff;
}
body[data-frame="sakura"] {
  --purple: #e86a9e; --purple-dark: #c2477d; --purple-light: #ffe7f1; --background: #fff5f9;
}
body[data-frame="lemon"] {
  --purple: #c9930a; --purple-dark: #a17607; --purple-light: #fff6d9; --background: #fffdf2;
}

/* 弱点しんだんへの導線バナー（今日の冒険・レベル帯の下） */
.shindan-banner {
  margin-top: 14px;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .2s;
}

.shindan-banner:hover { transform: translateY(-2px); }

.shindan-icon { background: #e0f2fe; }

.shindan-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.shindan-banner-text strong { font-size: 14px; font-weight: 900; }

.shindan-banner-text small {
  color: var(--text-light);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.55;
}

.shindan-banner-arrow {
  font-size: 18px;
  font-weight: 900;
  color: var(--purple);
}

.level-strip {
  margin-top: 14px;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.level-badge {
  flex-shrink: 0;
  background: var(--purple);
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  border-radius: 14px;
  padding: 10px 14px;
  text-align: center;
  line-height: 1.3;
}

.level-main { flex: 1; min-width: 0; }

.level-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  font-size: 14px;
  font-weight: 900;
}

.level-points { color: var(--purple); }

.level-bar {
  margin-top: 7px;
  height: 12px;
  background: var(--purple-light);
  border-radius: 999px;
  overflow: hidden;
}

.level-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  transition: width .4s ease;
}

.level-note {
  display: block;
  margin-top: 5px;
  color: var(--text-light);
  font-size: 11.5px;
  font-weight: 700;
}

.xp-gain {
  margin-top: 12px;
  font-weight: 900;
  color: var(--purple-dark);
}

.level-up-pop {
  margin-top: 10px;
  padding: 12px;
  background: var(--purple-light);
  border: 2px solid var(--purple);
  border-radius: 14px;
  font-weight: 900;
  font-size: 17px;
  color: var(--purple-dark);
  animation: levelPop .45s ease;
}

@keyframes levelPop {
  0% { transform: scale(.92); opacity: 0; }
  60% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .level-up-pop { animation: none; }
  .level-fill { transition: none; }
}

.pass-note {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 10px;
}

.pass-list { display: flex; flex-direction: column; gap: 6px; }

.pass-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1.5px solid #eae5f6;
  border-radius: 12px;
  background: #fcfbff;
  font-size: 13px;
  opacity: .55;
}

.pass-row.got { opacity: 1; background: #fff8e6; border-color: #e5c15c; }

.pass-lv { font-weight: 900; color: var(--purple-dark); flex-shrink: 0; }
.pass-name { flex: 1; font-weight: 800; min-width: 0; }

.pass-chip {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 900;
  background: white;
  border: 1.5px solid #e5c15c;
  border-radius: 999px;
  padding: 1px 10px;
}

.frame-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.frame-chip {
  flex: 1 1 130px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  border: 2px solid #eae5f6;
  border-radius: 14px;
  background: #fcfbff;
  cursor: pointer;
  font: inherit;
  line-height: 1.4;
}

.frame-chip.active { border-color: var(--purple); background: var(--purple-light); }
.frame-chip:disabled { cursor: default; opacity: .65; }
.frame-chip:not(:disabled):hover { border-color: var(--purple); }

.frame-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); }
.frame-name { font-size: 12.5px; font-weight: 900; }
.frame-chip small { color: var(--text-light); font-size: 10.5px; font-weight: 700; }

.seal-palette { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; min-height: 20px; }

.seal-chip, .seal-on-board {
  border: 2px solid #eae5f6;
  background: #fcfbff;
  border-radius: 12px;
  cursor: pointer;
  line-height: 1;
}

.seal-chip { font-size: 22px; padding: 6px 9px; }
.seal-chip.on { border-color: #e5c15c; background: #fff8e6; }

.seal-board {
  min-height: 74px;
  border: 2px dashed #d9d2f2;
  border-radius: 14px;
  background: #fffdf5;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.seal-on-board { font-size: 34px; padding: 5px 8px; border-color: transparent; background: transparent; }
.seal-on-board:hover { border-color: #e5c15c; }
.seal-empty { color: var(--text-light); font-size: 12px; font-weight: 700; }

.shop-balance { font-weight: 900; font-size: 14px; margin-bottom: 10px; color: var(--purple-dark); }
.shop-grid { display: flex; flex-direction: column; gap: 8px; }

.shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1.5px solid #eae5f6;
  border-radius: 12px;
  background: #fcfbff;
  font-size: 13px;
  flex-wrap: wrap;
}

.shop-name { flex: 1; font-weight: 800; min-width: 120px; }
.shop-price { font-weight: 900; color: var(--purple-dark); }
.shop-item .btn { padding: 7px 14px; font-size: 12.5px; }
.shop-msg { margin-top: 10px; font-weight: 900; color: var(--purple-dark); font-size: 13.5px; }

@media (max-width: 640px) {
  .level-strip { padding: 11px 13px; gap: 11px; }
  .level-badge { font-size: 15px; padding: 8px 10px; }
  .level-line { font-size: 13px; }
  .pass-row { font-size: 12px; padding: 6px 9px; gap: 7px; }
  .frame-chip { flex-basis: 100px; }
  .seal-on-board { font-size: 28px; }
  .shop-item { font-size: 12.5px; }
}

.rank-line {
  font-weight: 900;
  font-size: 15px;
  color: var(--purple-dark);
  margin-bottom: 10px;
}

.rank-head { margin-top: 14px; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.rank-list { display: flex; flex-direction: column; gap: 5px; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border: 1.5px solid #eae5f6;
  border-radius: 11px;
  background: #fcfbff;
  font-size: 12.5px;
  opacity: .6;
}

.rank-row.current { opacity: 1; background: var(--purple-light); border-color: var(--purple); }
.rank-band { font-weight: 900; color: var(--purple-dark); flex-shrink: 0; min-width: 74px; }
.rank-name { flex: 1; font-weight: 800; }

@media (max-width: 640px) {
  .rank-band { min-width: 62px; }
  .rank-row { font-size: 11.5px; padding: 5px 9px; gap: 7px; }
}

.footer-updated { width: 100%; text-align: center; padding-top: 4px; color: #a9a2bb; font-size: 10px; }
