:root {
      --bg: #050506;
      --s1: #141518;
      --s2: #1d1f23;
      --s3: #26292f;
      --t1: rgba(255, 255, 255, .92);
      --t2: rgba(255, 255, 255, .64);
      --t3: rgba(255, 255, 255, .43);
      --sep: rgba(255, 255, 255, .12);
      --blue: #72a7ff;
      --red: #ff6262;
      --green: #32c985;
      --yellow: #f4c542;
      --gold: #f4c542;
    }

    html {
      font-size: 14px;
      line-height: 1.45;
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
    }

    body {
      margin: 0;
      padding: 10px 12px 124px;
      background: var(--bg);
      color: var(--t1);
      font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", "Segoe UI", sans-serif;
      letter-spacing: 0;
      max-width: 420px;
      margin-inline: auto;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
    }

    *,
    *::before,
    *::after {
      box-sizing: border-box;
    }

    button,
    input,
    textarea {
      font: inherit;
      letter-spacing: 0;
    }

    .title-img {
      display: none;
    }

    .title-img img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .status,
    .card,
    .pending,
    .statbox,
    .setting-card {
      background: var(--s1);
      border: .5px solid var(--sep);
      border-radius: 8px;
    }

    .status {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      align-items: center;
      column-gap: 6px;
      padding: 6px 9px;
      margin-bottom: 8px;
      min-height: 55px;
      color: var(--t2);
      background: #141518;
    }

    .status.active {
      color: var(--gold);
      border-color: rgba(244, 197, 66, .28);
      background: #161612;
    }

    .status-main {
      min-width: 0;
    }

    .machine-name {
      color: var(--t1);
      font-size: .8rem;
      font-weight: 900;
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    #statusText {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 2px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: .71rem;
      line-height: 1.15;
      font-weight: 800;
      white-space: nowrap;
      font-variant-numeric: tabular-nums;
    }

    .status-dot {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: var(--t3);
      flex: 0 0 auto;
    }

    .status.active .status-dot {
      background: var(--gold);
    }

    .header-icon-btn,
    .gear-btn,
    .help-btn {
      width: 28px;
      min-width: 28px;
      height: 28px;
      min-height: 28px;
      padding: 0;
      border-radius: 999px;
      color: var(--t2);
      background: rgba(255, 255, 255, .04);
      border: .5px solid var(--sep);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: .9rem;
      font-weight: 900;
    }

    .status-playing {
      color: var(--gold);
    }

    .card,
    .pending,
    .setting-card {
      padding: 12px;
      margin-bottom: 10px;
    }

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

    .head b {
      font-size: 1.04rem;
    }

    .compact-title {
      font-size: .72rem;
      line-height: 1.2;
      font-weight: 800;
    }

    .head-title.inline-title {
      flex-direction: row;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .move-controls {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-left: auto;
    }

    .move-btn {
      min-width: 30px;
      width: 30px;
      min-height: 28px;
      height: 28px;
      padding: 0;
      border-radius: 6px;
      background: rgba(255, 255, 255, .06);
      color: var(--t2);
      font-size: .82rem;
      font-weight: 900;
    }

    .move-btn:disabled {
      opacity: .28;
      pointer-events: none;
    }

    .head-title {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }

    .sub {
      font-size: .72rem;
      color: var(--t2);
      font-weight: 800;
    }

    .sub-red {
      color: var(--red);
    }

    .grid-zone {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 6px;
    }

    .grid-2,
    .voice-grid,
    .cz-choice-grid,
    .answer-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 7px;
    }

    .cz-choice-grid {
      gap: 8px;
    }

    button {
      background: var(--s2);
      color: var(--t1);
      border: .5px solid var(--sep);
      border-radius: 8px;
      padding: 8px 4px;
      min-height: 46px;
      font-size: .95rem;
      font-weight: 850;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      flex-direction: column;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      outline: none;
    }

    button:active:not(:disabled) {
      transform: translateY(1px);
      background-color: var(--s3);
    }

    .btn-main {
      background: #252317;
      color: var(--gold);
      border-color: rgba(244, 197, 66, .34);
    }

    .count-btn {
      padding-bottom: 16px;
    }

    .button-count {
      margin-top: 4px;
      color: var(--gold);
      font-size: .72rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-weight: 900;
      line-height: 1;
    }

    .tap-meter {
      position: absolute;
      left: 6px;
      right: 6px;
      bottom: 5px;
      height: 4px;
      border-radius: 999px;
      background: rgba(255, 255, 255, .12);
      overflow: hidden;
    }

    .tap-meter-fill {
      height: 100%;
      width: 0%;
      border-radius: 999px;
      background: var(--gold);
    }

    .koyaku-locked {
      pointer-events: none;
      border-color: rgba(244, 197, 66, .6);
      background: rgba(244, 197, 66, .12);
    }

    .result-fail {
      background: rgba(255, 98, 98, .14);
      border-color: rgba(255, 98, 98, .45);
      color: var(--red);
      font-weight: 900;
    }

    .result-success {
      background: rgba(50, 201, 133, .14);
      border-color: rgba(50, 201, 133, .45);
      color: var(--green);
      font-weight: 900;
    }

    .result-fail::before,
    .result-success::before {
      font-size: 1.15rem;
      line-height: 1;
      margin-bottom: 2px;
    }

    .result-fail::before {
      content: "×";
    }

    .result-success::before {
      content: "○";
    }

    .panel {
      display: none;
    }

    .panel.active {
      display: block;
    }

    .pending-title {
      font-size: .84rem;
      font-weight: 900;
      margin-bottom: 8px;
    }

    .game-input {
      width: 100%;
      background: #111;
      color: var(--t1);
      border: .5px solid var(--sep);
      border-radius: 8px;
      padding: 14px 10px;
      font-size: 1.1rem;
      font-weight: 900;
      text-align: center;
      outline: none;
      margin-bottom: 8px;
    }

    .game-input.invalid {
      border-color: rgba(255, 69, 58, .85);
      box-shadow: 0 0 10px rgba(255, 69, 58, .3);
    }

    .czimg-btn,
    .end-btn {
      padding: 0;
      min-height: 0;
      overflow: hidden;
      border-radius: 0;
      background: #111;
      border: .5px solid var(--sep);
    }

    .czimg-btn img,
    .end-btn img {
      display: block;
      width: 100%;
      aspect-ratio: 16 / 9;
      object-fit: cover;
      pointer-events: none;
      border-radius: 0;
    }

    .czimg-btn span {
      display: block;
      width: 100%;
      padding: 8px 6px;
      font-size: .82rem;
      font-weight: 900;
      background: rgba(255, 255, 255, .04);
    }

    .voice-btn {
      height: 82px;
      min-height: 82px;
      max-height: 82px;
      padding: 18px 7px 16px;
      justify-content: center;
    }

    .voice-name {
      position: absolute;
      top: 5px;
      left: 50%;
      transform: translateX(-50%);
      font-size: .63rem;
      font-weight: 900;
      color: var(--t2);
      white-space: nowrap;
    }

    .voice-line {
      line-height: 1.18;
      font-size: .88rem;
      font-weight: 800;
      text-align: center;
      width: 100%;
    }

    .voice-meter {
      position: absolute;
      left: 6px;
      right: 6px;
      bottom: 5px;
      height: 4px;
      border-radius: 999px;
      background: rgba(255, 255, 255, .12);
      overflow: hidden;
    }

    .voice-meter-fill {
      height: 100%;
      width: 0%;
      border-radius: 999px;
      background: var(--gold);
    }

    #cardVoice.voice-lock button {
      opacity: .42;
      pointer-events: none;
    }

    #cardVoice.voice-lock button.selected {
      opacity: 1;
      border-color: rgba(244, 197, 66, .6);
      background: rgba(244, 197, 66, .12);
    }

    .statbox {
      overflow: hidden;
      margin-bottom: 10px;
    }

    .stat-title {
      background: rgba(255, 255, 255, .035);
      color: var(--t2);
      font-size: .74rem;
      font-weight: 900;
      padding: 7px 9px;
      border-bottom: .5px solid var(--sep);
    }

    .stat-row {
      display: grid;
      grid-template-columns: minmax(88px, 1fr) 62px 58px;
      align-items: center;
      gap: 6px;
      padding: 6px 9px;
      border-bottom: .5px solid rgba(255, 255, 255, .06);
      font-size: .78rem;
    }

    .zone-stat-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(54px, 1fr));
      overflow-x: auto;
      scrollbar-width: none;
    }

    .zone-stat-grid::-webkit-scrollbar {
      display: none;
    }

    .zone-stat-cell {
      min-width: 54px;
      padding: 7px 4px;
      border-right: .5px solid rgba(255, 255, 255, .06);
      text-align: center;
      font-size: .69rem;
    }

    .zone-stat-cell:last-child {
      border-right: 0;
    }
    .zone-label {
      font-weight: 900;
      color: var(--t1);
      margin-bottom: 4px;
    }

    .zone-count,
    .zone-pct {
      font-family: ui-monospace, monospace;
      white-space: nowrap;
    }

    .zone-count {
      color: var(--t2);
      margin-bottom: 2px;
    }

    .zone-pct {
      color: var(--gold);
      font-weight: 900;
    }

    .stat-row:last-child {
      border-bottom: 0;
    }

    .stat-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .stat-count,
    .stat-pct {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      text-align: right;
      white-space: nowrap;
      font-variant-numeric: tabular-nums;
    }

    .stat-pct {
      color: var(--t2);
    }

    .log-area {
      margin-top: 16px;
      font-size: .84rem;
      line-height: 1.5;
    }

    .log-section-label {
      margin: 16px 2px 7px;
      color: var(--t3);
      font-size: .72rem;
      font-weight: 900;
    }

    .log-empty {
      color: var(--t3);
      font-size: .82rem;
      padding: 8px 2px;
    }

    .log-row {
      display: grid;
      grid-template-columns: 42px 1fr;
      gap: 8px;
      align-items: flex-start;
      border-bottom: .5px solid var(--sep);
      padding: 8px 0;
    }

    .log-time {
      color: var(--t3);
      font-size: .75rem;
      white-space: nowrap;
      margin-top: 1px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-variant-numeric: tabular-nums;
    }

    .log-text {
      white-space: pre-wrap;
      min-width: 0;
      font-weight: 500;
    }

    .muted {
      color: var(--t2);
    }

    .summary-card {
      border: .5px solid var(--sep);
      border-left: 3px solid var(--gold);
      background: var(--s1);
      border-radius: 8px;
      margin-bottom: 8px;
      overflow: hidden;
    }

    .summary-head {
      display: grid;
      grid-template-columns: auto 1fr auto auto auto;
      align-items: center;
      gap: 6px;
      padding: 7px 8px;
      font-weight: 900;
      cursor: pointer;
    }

    .summary-date {
      width: 82px;
      color: var(--t1);
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: .78rem;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .summary-head-meta {
      color: var(--t3);
      font-size: .72rem;
      font-weight: 900;
    }

    .summary-arrow {
      color: var(--t3);
      font-size: .7rem;
    }

    .summary-body {
      display: none;
      padding: 8px;
      border-top: .5px solid var(--sep);
    }

    .summary-card.open .summary-body {
      display: block;
    }

    .cancel {
      min-width: 34px;
      padding: 4px 8px;
      border-radius: 8px;
      background: rgba(255, 255, 255, .06);
      color: var(--t2);
      border: 0;
      font-size: .78rem;
      min-height: 28px;
    }

    .summary-close {
      min-width: 32px;
      width: 32px;
      height: 30px;
      padding: 0;
      border-radius: 8px;
      background: rgba(255, 255, 255, .06);
      color: var(--t2);
      border: .5px solid rgba(255, 255, 255, .08);
      font-size: 1rem;
      font-weight: 900;
      min-height: 30px;
    }

    .delete-summary {
      min-width: 46px;
      padding: 4px 8px;
      border-radius: 8px;
      background: rgba(255, 98, 98, .14);
      color: var(--red);
      border: .5px solid rgba(255, 98, 98, .45);
      font-size: .78rem;
      font-weight: 900;
      min-height: 28px;
    }

    .detail {
      margin-top: 8px;
    }

    .detail summary {
      color: var(--t2);
      font-size: .75rem;
      font-weight: 900;
      cursor: pointer;
    }

    .detail-list {
      color: var(--t2);
      font-size: .72rem;
      white-space: pre-wrap;
      margin-top: 6px;
    }

    .dock {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
      background: rgba(20, 21, 24, .96);
      backdrop-filter: blur(16px);
      border-top: .5px solid var(--sep);
      z-index: 999;
    }

    .dock button {
      min-height: 52px;
    }

    .modal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .72);
      z-index: 2000;
      display: none;
      padding: 18px 10px 96px;
      overflow: auto;
    }

    .modal.open {
      display: block;
    }

    .modal-inner {
      max-width: 430px;
      margin: 0 auto;
    }

    .modal-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-weight: 900;
    }

    .modal-close {
      min-height: 36px;
      padding: 6px 12px;
      color: var(--t2);
    }

    .setting-question {
      font-size: .9rem;
      font-weight: 900;
      line-height: 1.45;
      margin-bottom: 8px;
    }

    .setting-note {
      font-size: .73rem;
      color: var(--t2);
      font-weight: 800;
      margin-bottom: 10px;
    }

    .rate-table {
      width: 100%;
      border-collapse: collapse;
      margin: 8px 0 10px;
      font-size: .76rem;
    }

    .rate-table th,
    .rate-table td {
      border: .5px solid var(--sep);
      padding: 7px 4px;
      text-align: center;
    }

    .rate-table th {
      background: var(--s3);
      font-weight: 900;
    }

    .rate-table td:first-child {
      background: rgba(255, 255, 255, .08);
      font-weight: 800;
    }

    .answer-grid button.selected {
      border-color: var(--yellow);
      box-shadow: 0 0 10px rgba(255, 214, 10, .28);
      background: rgba(255, 214, 10, .10);
    }

