:root {
  --paper: #ffffff;
}

* { box-sizing: border-box; }

body.cheatsheet-page {
  min-height: 100vh;
  margin: 0;
  padding: 0 0 40px;
  background: var(--bg);
}

.cheatsheet-page .phone-sheet {
  margin: var(--page-top-gap) auto 0;
}

.phone-sheet button, .phone-sheet a { font: inherit; }

.phone-sheet {
  width: min(100%, 390px);
  min-height: min(844px, calc(100vh - 48px));
  padding: 20px 18px max(18px, env(safe-area-inset-bottom));
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(31, 59, 58, 0.18);
}

.sheet-header, .title-row, .scenario-top, .card-answer, footer {
  display: flex;
  align-items: center;
}

.sheet-header { justify-content: flex-end; }

.sheet-header button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.sheet-header button:not(:disabled) { cursor: pointer; }
.sheet-header button:disabled { cursor: wait; opacity: .58; }

.title-row {
  justify-content: space-between;
  gap: 12px;
  margin: 23px 2px 16px;
}

.title-row p { margin: 0 0 3px; color: var(--teal); font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.title-row h1 { margin: 0; font-size: 25px; line-height: 1; letter-spacing: -.035em; }
.title-row time { max-width: 82px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: right; }

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

.scenario-card {
  min-width: 0;
  min-height: 122px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #fff, #f8fbfb);
}

.scenario-top { gap: 6px; min-width: 0; }
.scenario-top > strong { font-size: 11px; }
.scenario-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #e7f5f3; color: var(--teal); font-size: 12px; font-weight: 900; }
.activate-badge { margin-left: auto; padding: 3px 5px; border-radius: 999px; background: #fff2cc; color: #8a5b00; font-size: 7px; letter-spacing: .04em; text-transform: uppercase; }

.card-answer { align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 14px; }
.card-answer h2 { margin: 0; max-width: 112px; font-size: 13px; line-height: 1.17; letter-spacing: -.015em; }
.rate { flex-shrink: 0; color: var(--teal); font-size: 19px; font-weight: 900; line-height: 1; }
.scenario-card p { margin: 8px 0 0; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

.loading-card {
  grid-column: 1 / -1;
  min-height: 430px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-gate {
  min-height: 510px;
  padding: 70px 28px 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, #f4fbfa, #ffffff);
  text-align: center;
}

.auth-gate[hidden] { display: none; }
.auth-mark { font-size: 34px; }
.auth-gate h2 { margin: 18px 0 8px; font-size: 20px; letter-spacing: -.02em; }
.auth-gate p { margin: 0 auto 22px; max-width: 240px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-gate button { display: inline-flex; padding: 10px 15px; border: 0; border-radius: 999px; background: var(--teal); color: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }

.error-card a { color: var(--teal); }

footer {
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 8px;
}

footer p { margin: 0; }
footer a { flex-shrink: 0; color: var(--teal); font-size: 9px; font-weight: 800; text-decoration: none; }

.download-status {
  min-height: 13px;
  margin: 7px 0 -4px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 750;
  text-align: right;
}

@media (max-width: 440px) {
  body.cheatsheet-page { padding: 0; background: #fff; }
  .cheatsheet-page .phone-sheet { width: 100%; min-height: 100svh; margin-top: var(--page-top-gap); border: 0; border-radius: 0; box-shadow: none; }
}

@media print {
  @page { size: 390px 844px; margin: 0; }
  body.cheatsheet-page { padding: 0; background: #fff; }
  .cheatsheet-page .phone-sheet { width: 390px; min-height: 844px; margin-top: 0; border: 0; border-radius: 0; box-shadow: none; }
  .site-header, .sheet-header button, .download-status { display: none; }
}
