:root {
  color-scheme: light;
  --ink: #22272f;
  --muted: #687080;
  --line: #dce3ea;
  --paper: #ffffff;
  --soft: #fff7df;
  --accent: #137c72;
  --accent-dark: #0f625b;
  --coral: #e86f50;
  --sun: #f5bd42;
  --mark: rgba(19, 124, 114, 0.2);
  --shadow: 0 24px 60px rgba(34, 39, 47, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light only;
  background: #fff7df;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(19, 124, 114, 0.2), transparent 34%),
    linear-gradient(315deg, rgba(232, 111, 80, 0.18), transparent 36%),
    linear-gradient(180deg, #fff7df 0%, #edf8f4 58%, #f4edf8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  color-scheme: light only;
  font: inherit;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(720px, 1.28fr);
  gap: 18px;
  align-items: center;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 0;
}

.app-brand {
  align-self: center;
  min-width: 0;
}

.app-brand h1 {
  margin: 0;
  color: #1f2933;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1;
}

.welcome-message {
  margin: 8px 0 0;
  color: var(--accent-dark);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
}

.header-account {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.header-auth {
  grid-template-columns: minmax(150px, 0.45fr) minmax(360px, 1fr);
  align-items: center;
  width: min(100%, 680px);
  min-width: 620px;
}

.header-auth > div:first-child {
  min-width: 145px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(360px, 1fr);
  gap: 24px;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  height: calc(100vh - 126px);
  padding: 16px 0 28px;
  overflow: hidden;
}

@media (min-width: 1200px) {
  .app-shell {
    grid-template-columns: minmax(520px, 1fr) minmax(520px, 1fr);
  }
}

.panel {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.controls {
  position: relative;
  align-self: start;
  display: grid;
  gap: 22px;
  max-height: 100%;
  padding: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.controls::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--accent), var(--sun), var(--coral));
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.96;
  color: #1f2933;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.intro {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.beta-token-card {
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: center;
  gap: 7px;
  min-width: 132px;
  min-height: 100%;
  border: 1px solid #b8ded7;
  border-radius: 8px;
  background: linear-gradient(135deg, #ecfbf7, #fff9e8);
  padding: 10px 12px;
  text-align: center;
}

.beta-token-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.beta-token-card strong {
  display: block;
  color: #26313d;
  font-size: 1.45rem;
  line-height: 1;
}

.beta-token-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: center;
}

.auth-card {
  display: grid;
  gap: 10px;
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 10px;
}

.auth-kicker {
  display: block;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 2px 0 4px;
  font-size: 1rem;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-card p.error {
  color: #a23737;
}

.auth-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-heading-row > div {
  min-width: 0;
}

.settings-button,
.mobile-settings-button {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form label span {
  color: #39414d;
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
button.secondary.buy-tokens-button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border-color: #d89a16;
  background: var(--sun);
  color: #2d2308;
  box-shadow: 0 5px 12px rgba(151, 98, 8, 0.18);
  white-space: nowrap;
}

button.secondary.buy-tokens-button:hover:not(:disabled) {
  border-color: #c4870c;
  background: #e9ab28;
  color: #211a06;
}

.header-auth #login-form {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  align-items: end;
  gap: 8px;
}

.header-auth #login-form button {
  min-height: 48px;
  padding: 0 12px;
  line-height: 1.05;
  white-space: normal;
}

.header-auth #sign-in-button,
.header-auth #show-sign-up-button {
  width: 100%;
}

.mobile-account-actions {
  display: none;
}

.mobile-account-buttons {
  display: grid;
  gap: 6px;
}

.mobile-recent-actions {
  display: none;
}
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

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

.settings-dialog {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 18px;
}

.settings-dialog[hidden] {
  display: none;
}

.settings-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 36, 46, 0.56);
}

.settings-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: hidden;
  border: 1px solid #ccd7df;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2 {
  margin: 3px 0 0;
  font-size: 1.45rem;
}

.settings-close {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.settings-close:hover:not(:disabled) {
  background: #f2f6f5;
  color: var(--ink);
}

.settings-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px 24px;
}

.settings-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.account-details {
  margin: 0;
}

.account-details > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f4;
}

.account-details > div:last-child {
  border-bottom: 0;
}

.account-details dt {
  color: var(--muted);
  font-weight: 700;
}

.account-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.settings-note,
.settings-section p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.contact-email-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid var(--accent-dark);
  border-radius: 7px;
  background: var(--accent);
  padding: 8px 14px;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
}

.contact-email-button:hover {
  background: var(--accent-dark);
}

.contact-email-button:focus-visible {
  outline: 3px solid rgba(19, 124, 114, 0.28);
  outline-offset: 3px;
}

.contact-email-address {
  overflow-wrap: anywhere;
}

.policy-section details {
  border-top: 1px solid var(--line);
}

.policy-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.policy-section summary {
  padding: 13px 2px;
  cursor: pointer;
  color: #26313d;
  font-weight: 850;
}

.policy-section details[open] {
  padding-bottom: 14px;
}

.policy-section details p {
  padding: 0 2px;
}

.danger-zone h3 {
  color: #a23737;
}

.danger-zone label {
  display: block;
  margin: 15px 0 6px;
  color: #39414d;
  font-size: 0.8rem;
  font-weight: 800;
}

.danger-zone input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d4dbe1;
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
}

.danger-zone button {
  width: 100%;
  margin-top: 10px;
  background: #bd3f38;
  color: #fff;
}

.danger-zone button:hover:not(:disabled) {
  background: #9f302c;
}

.settings-status {
  min-height: 20px;
}

.settings-status.error {
  color: #a23737;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 36, 46, 0.48);
}

.auth-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  border: 1px solid rgba(19, 124, 114, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(27, 37, 52, 0.24);
  padding: 24px;
}

.auth-modal-panel h2 {
  margin: 2px 0 12px;
  font-size: 1.35rem;
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.auth-modal-close:hover:not(:disabled) {
  background: #f4f8f7;
}
.welcome-dialog {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 18px;
}

.welcome-dialog[hidden] {
  display: none;
}

.welcome-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 36, 46, 0.46);
}

.welcome-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  border: 1px solid rgba(19, 124, 114, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(27, 37, 52, 0.24);
  padding: 26px;
}

.welcome-dialog-panel h2 {
  margin: 4px 0 12px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.08;
}

.welcome-dialog-panel p:not(.eyebrow) {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.welcome-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 18px;
}

.welcome-examples span {
  border: 1px solid rgba(19, 124, 114, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #ecfbf7, #fff9e8);
  color: #26313d;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 10px 12px;
}

.welcome-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.welcome-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.welcome-dialog-close:hover:not(:disabled) {
  background: #f4f8f7;
}

@media (max-width: 560px) {
  .welcome-dialog-panel {
    padding: 22px;
  }

  .welcome-examples {
    grid-template-columns: 1fr;
  }
}

form {
  display: grid;
  gap: 18px;
}

#wordsearch-form.is-recent-puzzle-mode .builder-setup,
#wordsearch-form:not(.has-generated-puzzle) .builder-generated-only,
#wordsearch-form.has-generated-puzzle .simple-generate-action,
#wordsearch-form.has-ai-image .ai-generate-action,
#wordsearch-form:not(.has-ai-image) .existing-ai-action,
#wordsearch-form:not(.has-ai-image) .ai-only-control {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
}

.field-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
}

.words-heading {
  justify-content: space-between;
  align-items: center;
}

.words-heading > span {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
}

button.secondary.generate-words-button {
  min-height: 34px;
  border: 0;
  background: linear-gradient(135deg, #8a4fd1, #5c3ca3);
  color: #fff;
  padding: 0 12px;
  font-size: 0.78rem;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(92, 60, 163, 0.2);
}

button.secondary.generate-words-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #7741bc, #4d318d);
}

.field > span,
.words-heading b,
legend {
  color: #39414d;
  font-size: 0.87rem;
  font-weight: 800;
}

.field-heading small {
  color: var(--muted);
  font-weight: 700;
}

.words-helper {
  margin-top: -4px;
}

.word-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: #39414d;
  font-size: 0.8rem;
}

.word-stats b {
  font-weight: 900;
}

.field small,
.helper-note,
.action-token-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.action-token-note {
  margin: -2px 0 0;
  font-weight: 800;
}

.action-token-note b {
  color: var(--sun);
}

#beta-token-balance,
#simple-token-cost,
#ai-token-cost,
#ai-edit-token-cost,
#simple-button-cost,
#ai-button-cost,
#ai-edit-button-cost,
#action-token-balance {
  color: var(--sun);
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  transition: border 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
  text-transform: uppercase;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(19, 124, 114, 0.15);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.design-controls {
  display: grid;
  gap: 16px;
  margin: 0;
  border: 1px solid #c4dfdc;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(236, 251, 247, 0.78), rgba(255, 249, 232, 0.5));
  padding: 16px;
}

.design-controls legend {
  padding: 0 8px;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.design-controls p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
}

.direction-field {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbf7ef);
  padding: 14px;
}

.direction-field label,
.checkbox-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  color: #3e4651;
  line-height: 1.35;
}

.slider-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #39414d;
}

.slider-value {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 900;
  text-align: right;
}
.scale-field input {
  width: 100%;
  accent-color: var(--accent);
}

.direction-field label {
  grid-template-columns: 20px 18px 1fr;
  align-items: center;
}

.option-number {
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
}

.direction-field label + label {
  margin-top: 11px;
}

input[type="radio"],
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

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

.actions button {
  flex: 1 1 auto;
}

.fixed-builder-actions {
  position: sticky;
  bottom: -1px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
  padding: 12px 0 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 253, 246, 0.96) 26%, rgba(255, 253, 246, 0.98));
  backdrop-filter: blur(10px);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #16957e);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 18px;
  line-height: 1.15;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

#generate-art-button,
#edit-art-button,
.actions button {
  white-space: nowrap;
}

.fixed-builder-actions button {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 56px;
  padding: 7px 8px;
  line-height: 1.05;
  white-space: normal;
}
.fixed-builder-actions button span,
.fixed-builder-actions button small,
.fixed-builder-actions button b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fixed-builder-actions button small {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.08;
}

.fixed-builder-actions button b {
  color: var(--sun);
  font-size: 0.9rem;
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-dark), #117c69);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover:not(:disabled) {
  background: #f4f8f7;
}

#generate-art-button {
  background: linear-gradient(135deg, #8a4fd1, #5c3ca3);
  color: #fff;
  box-shadow: 0 8px 18px rgba(92, 60, 163, 0.2);
}

button#generate-art-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #7741bc, #4d318d);
}

#edit-art-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

#edit-art-button:not(:disabled) {
  border: 0;
  background: linear-gradient(135deg, #8a4fd1, #5c3ca3);
  color: #fff;
  box-shadow: 0 8px 18px rgba(92, 60, 163, 0.2);
}

button#edit-art-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #7741bc, #4d318d);
}

#print-button,
#preview-print-button {
  border: 0;
  background: linear-gradient(135deg, #2f83d6, #2568ad);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 131, 214, 0.18);
}

#print-button:hover:not(:disabled),
#preview-print-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #2875c2, #1f5c99);
}

.ai-edit-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  border: 1px solid #f1d8a8;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff9e8, #f2fbf7);
  padding: 14px;
}

.ai-edit-card label {
  display: grid;
  gap: 5px;
}

.ai-edit-card textarea {
  min-height: 88px;
  text-transform: none;
}

.ai-edit-card label span {
  color: #39414d;
  font-size: 0.78rem;
  font-weight: 800;
}
.ai-disclaimer {
  margin: 0;
  color: #8a6130;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.status.error {
  color: #a23737;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(34, 39, 47, 0.48);
  backdrop-filter: blur(3px);
}

.is-loading .loading-overlay {
  display: grid;
}

.loading-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  width: min(320px, calc(100% - 48px));
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.spinner {
  width: 54px;
  height: 54px;
  border: 6px solid #dce3ea;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.preview-panel {
  position: relative;
  align-self: start;
  min-width: 0;
  max-height: 100%;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.preview-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(245, 189, 66, 0.14), transparent 36%, rgba(19, 124, 114, 0.1));
}

.preview-toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 18px;
  padding: 0 4px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  max-width: min(100%, 640px);
  min-width: 0;
}

.page-nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.preview-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: start;
}

.preview-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.preview-lower-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 46px;
  padding: 0;
}

.edit-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.edit-review-actions[hidden] {
  display: none;
}

#keep-edit-button,
#revert-edit-button,
#preview-print-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.78rem;
}

#preview-print-button {
  margin-left: auto;
}

#revert-edit-button {
  border-color: rgba(200, 78, 68, 0.28);
  color: #8e332e;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 8px 12px;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
}

#delete-current-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: linear-gradient(135deg, #c84e44, #a63b34);
  color: #fff;
  font-size: 0.78rem;
  box-shadow: 0 8px 18px rgba(166, 59, 52, 0.18);
}

#show-test-page-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.78rem;
  white-space: nowrap;
}

#delete-current-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #b9433b, #922f2b);
  transform: translateY(-1px);
}

.recent-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: calc(100vh - 178px);
  max-height: calc(100vh - 178px);
  padding: 14px;
  border: 1px solid rgba(19, 124, 114, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(237, 248, 244, 0.9), rgba(244, 237, 248, 0.68));
  overflow: hidden;
}

.recent-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}
.recent-panel h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.recent-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 272px);
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.recent-empty,
.recent-limit {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.recent-limit {
  border: 1px solid #f1d8a8;
  border-radius: 8px;
  background: rgba(255, 247, 223, 0.9);
  color: #7a4d16;
  font-weight: 800;
  padding: 9px;
}

.recent-item {
  display: grid;
  width: 100%;
  min-height: 0;
  padding: 10px;
  border: 1px solid rgba(19, 124, 114, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.recent-item:hover:not(:disabled),
.recent-item.is-active {
  border-color: rgba(19, 124, 114, 0.42);
  background: #fff;
  color: var(--ink);
  transform: none;
}

.recent-item strong {
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-area {
  --preview-page-height: clamp(430px, calc(100vh - 330px), 760px);
  --preview-page-width: min(100%, calc(var(--preview-page-height) * 0.7070707));
  position: relative;
  display: grid;
  gap: 18px;
  justify-items: center;
  width: 100%;
  min-width: 0;
  max-height: var(--preview-page-height);
  overflow: hidden;
  overscroll-behavior: contain;
}

.print-area.preview-paged {
  height: var(--preview-page-height);
  align-items: start;
}

.print-area.preview-paged .page {
  display: none;
}

.print-area.preview-paged .page.is-preview-active {
  display: grid;
  width: var(--preview-page-width);
  height: auto;
  min-height: 0;
  aspect-ratio: 210 / 297;
}

.print-area.preview-paged .page.coloring-page.is-preview-active {
  display: block;
  width: var(--preview-page-width);
  height: auto;
  min-height: 0;
  aspect-ratio: 210 / 297;
}

.page {
  container-type: inline-size;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100%, 794px);
  aspect-ratio: 210 / 297;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 44px rgba(34, 39, 47, 0.16);
  padding: 6.6667% 7.1429%;
}

.page.is-empty {
  place-items: center;
}

.page.coloring-page {
  display: block;
  position: relative;
  padding: 0;
}

.coloring-sheet {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
  border: 0;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.coloring-sheet::after {
  content: none;
  position: absolute;
  inset: 18px;
  z-index: 1;
  pointer-events: none;
  border: 3px solid #111;
}

.ai-finished-worksheet {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  transform: scale(var(--ai-background-scale, 1));
  transform-origin: center;
  filter: grayscale(1) contrast(1.04);
}

.coloring-title {
  position: relative;
  z-index: 2;
  margin: 4px auto 18px;
  max-width: 560px;
  color: #fff;
  font-family: "Arial Black", "Trebuchet MS", sans-serif;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 3px #111;
  paint-order: stroke fill;
}

.coloring-center {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
  align-content: center;
  justify-items: center;
  margin: 0 auto;
  transform: scale(var(--puzzle-scale, 1));
  transform-origin: center;
}

.coloring-center .grid {
  width: min(100%, 478px);
  background: #fff;
}

.coloring-word-box {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 18px 22px;
}

.coloring-sheet.has-ai-background-art {
  position: absolute;
  inset: 0;
  display: block;
  min-height: 0;
  height: 100%;
}

.coloring-sheet.has-ai-background-art .coloring-center {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  margin: 0;
  transform: none;
}

.coloring-sheet.has-ai-background-art .coloring-foreground {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 18px;
  justify-items: center;
  width: 52%;
  transform: translate(-50%, calc(-50% + var(--puzzle-y-offset, 0%))) scale(var(--puzzle-scale, 1));
  transform-origin: center;
}

.coloring-sheet.has-ai-background-art .coloring-center .grid {
  width: 100%;
  background: rgba(255, 255, 255, var(--puzzle-opacity, 0.94));
}

.coloring-sheet.has-ai-background-art .coloring-word-box {
  width: 100%;
  min-height: 12.4%;
  margin: 0;
  padding: clamp(8px, 1.5cqw, 15px) clamp(10px, 2cqw, 20px);
}

.coloring-sheet.has-ai-background-art .cell {
  background: transparent;
  font-size: clamp(0.72rem, calc(29cqw / var(--size)), 1.9rem);
}

.coloring-sheet.has-ai-background-art .grid-full,
.coloring-sheet.has-ai-background-art .grid-full-rounded {
  gap: 0;
}

.coloring-sheet.has-ai-background-art .grid-full .cell,
.coloring-sheet.has-ai-background-art .grid-full-rounded .cell {
  border-right: var(--puzzle-cell-line-width, 1px) solid rgba(34, 39, 47, 0.32);
  border-bottom: var(--puzzle-cell-line-width, 1px) solid rgba(34, 39, 47, 0.32);
}

.coloring-sheet.has-ai-background-art .word-list {
  gap: clamp(4px, 0.9cqw, 9px) clamp(8px, 2cqw, 20px);
  font-size: clamp(0.56rem, 1.85cqw, 1rem);
  line-height: 1.2;
}

.empty-state {
  max-width: 360px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 1.6rem;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.5;
}

.print-header {
  display: flex;
  justify-content: space-between;
  gap: 2.5cqw;
  align-items: start;
  border-bottom: 0.2940cqw solid var(--ink);
  padding-bottom: 2.3cqw;
}

.print-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 4.7037cqw;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.print-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 2.1167cqw;
  font-weight: 700;
  text-align: right;
}

.puzzle-layout {
  display: grid;
  align-content: center;
  gap: 3.5cqw;
  padding: 4.3cqw 0 3cqw;
  transform: translateY(var(--puzzle-y-offset, 0%)) scale(var(--puzzle-scale, 1));
  transform-origin: center;
  min-width: 0;
}

.grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  width: min(100%, 94.4444cqw);
  aspect-ratio: 1;
  margin: 0 auto;
  border: var(--puzzle-border-width, 3px) solid var(--ink);
  background: var(--ink);
  gap: var(--puzzle-grid-gap, 2px);
}

.grid-border,
.grid-full {
  border-radius: var(--puzzle-radius, 8px);
  overflow: hidden;
}

.grid-border {
  background: #fff;
  gap: 0;
}

.grid-border .cell {
  border: 0;
}

.grid-rounded {
  background: #fff;
  border-radius: var(--puzzle-radius, 8px);
  gap: 0;
  overflow: hidden;
}

.grid-rounded .cell {
  border: 0;
}

.grid-full-rounded {
  border-radius: var(--puzzle-radius, 8px);
  overflow: hidden;
}

.grid-none {
  border-color: transparent;
  background: transparent;
  gap: 0;
}

.grid-none .cell {
  border: 0;
  background: transparent;
}

.cell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: calc(34cqw / var(--size));
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.font-bold .cell,
.word-list.font-bold {
  font-family: "Arial Black", Arial, sans-serif;
}

.font-rounded .cell,
.word-list.font-rounded {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  font-weight: 900;
}

.font-bubble .cell,
.word-list.font-bubble {
  font-family: "Cooper Black", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-weight: 900;
}

.font-soft .cell,
.word-list.font-soft {
  font-family: "Century Gothic", "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
}

.font-comic .cell,
.word-list.font-comic {
  font-family: "Comic Sans MS", "Trebuchet MS", cursive;
  font-weight: 900;
}

.font-nunito .cell,
.word-list.font-nunito {
  font-family: Nunito, "Aptos Rounded", "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
}

.font-quicksand .cell,
.word-list.font-quicksand {
  font-family: Quicksand, "Century Gothic", "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
}

.font-marker .cell,
.word-list.font-marker {
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-weight: 900;
}

.font-chalk .cell,
.word-list.font-chalk {
  font-family: "Comic Sans MS", "Bradley Hand ITC", "Trebuchet MS", cursive;
  font-weight: 900;
}

.font-typewriter .cell,
.word-list.font-typewriter {
  font-family: "Courier New", Consolas, monospace;
  font-weight: 900;
}

.font-hand .cell,
.word-list.font-hand {
  font-family: "Segoe Print", "Bradley Hand ITC", "Comic Sans MS", cursive;
  font-weight: 900;
}

.font-storybook .cell,
.word-list.font-storybook {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
}

.answer-grid .cell {
  position: relative;
}

.answer-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.38;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1cqw 2.2cqw;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #2d333d;
  font-size: 2.05cqw;
  font-weight: 800;
  text-align: center;
}

.word-list-box {
  width: min(100%, 78cqw);
  margin: 0 auto;
  border: var(--puzzle-border-width, 3px) solid var(--ink);
  background: #fff;
  padding: 2.3cqw 2.8cqw;
}

.coloring-word-box.word-list-box {
  width: min(100%, 430px);
}

.wordbox-border,
.wordbox-full,
.wordbox-rounded,
.wordbox-full-rounded {
  border-radius: var(--puzzle-radius, 8px);
  overflow: hidden;
}

.wordbox-none {
  border-color: transparent;
}

.coloring-sheet.has-ai-background-art .wordbox-border,
.coloring-sheet.has-ai-background-art .wordbox-full,
.coloring-sheet.has-ai-background-art .wordbox-rounded,
.coloring-sheet.has-ai-background-art .wordbox-full-rounded,
.coloring-sheet.has-ai-background-art .wordbox-none {
  background: rgba(255, 255, 255, var(--puzzle-opacity, 0.94));
}

.print-footer {
  border-top: 0.1470cqw solid var(--line);
  color: var(--muted);
  font-size: 2.0226cqw;
  padding-top: 2.0579cqw;
}

.answer-page {
  break-before: page;
}

.answer-page .grid {
  width: min(100%, 87.7778cqw);
}

.answer-key {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #3e4651;
  font-size: 0.85rem;
  font-weight: 700;
}

.mobile-preview-topbar,
.mobile-editor-dock,
.mobile-words-continue,
.mobile-home-screen,
.mobile-home-button {
  display: none;
}
@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(100% - 18px, 1440px);
  }

  .header-account {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .header-account > * {
    flex: 1 1 220px;
  }

  .header-auth {
    min-width: 0;
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 18px, 1440px);
    height: auto;
    padding: 12px 0 24px;
    overflow: visible;
  }

  .controls {
    max-height: none;
    overflow: visible;
    position: static;
  }

  .preview-panel {
    max-height: none;
  }

  .preview-content {
    grid-template-columns: 1fr;
  }

  .preview-lower-actions {
    padding: 0;
  }

  .recent-panel {
    min-height: 0;
    max-height: none;
  }

  .recent-list {
    max-height: 260px;
  }

  .print-area {
    max-height: none;
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .app-header {
    width: min(100% - 18px, 1440px);
    padding-top: 9px;
  }

  .app-brand h1 {
    font-size: 1.45rem;
  }

  .header-account {
    display: grid;
    grid-template-columns: 1fr;
  }

  .header-auth {
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .header-auth #login-form {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100% - 18px, 1440px);
    padding: 9px 0;
  }

  .controls,
  .preview-panel {
    padding: 16px;
  }

  .form-grid,
  .auth-actions,
  .ai-edit-card {
    grid-template-columns: 1fr;
  }

  .words-heading {
    align-items: stretch;
  }

  button.secondary.generate-words-button {
    width: 100%;
  }

  .beta-token-card {
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: center;
  gap: 7px;
  min-width: 132px;
  min-height: 100%;
  border: 1px solid #b8ded7;
  border-radius: 8px;
  background: linear-gradient(135deg, #ecfbf7, #fff9e8);
  padding: 10px 12px;
  text-align: center;
}
}
@media (max-width: 980px) {
  body.mobile-preview-open {
    overflow: hidden;
  }

  body.mobile-preview-open .app-header,
  body.mobile-preview-open .controls {
    display: none;
  }

  body.mobile-preview-open .app-shell {
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  body.mobile-preview-open .preview-panel {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, #fff7df 0%, #edf8f4 58%, #f4edf8 100%);
    box-shadow: none;
    overflow: hidden;
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  body.mobile-preview-open .preview-panel::before {
    display: none;
  }

  body.mobile-preview-open .mobile-preview-topbar {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(62px, 0.75fr) minmax(62px, 0.75fr) minmax(104px, 1.2fr) minmax(62px, 0.75fr);
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
  }

  body.mobile-preview-open .mobile-preview-topbar button {
    min-height: 42px;
    padding: 0 10px;
    font-size: 0.8rem;
    line-height: 1.05;
    white-space: normal;
  }

  body.mobile-preview-open #mobile-edit-preview {
    background: linear-gradient(135deg, #8a4fd1, #5c3ca3);
    color: #fff;
  }

  body.mobile-preview-open .preview-toolbar {
    display: none;
  }

  body.mobile-preview-open .preview-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-preview-open .preview-main {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 0;
  }

  body.mobile-preview-open .print-area {
    --preview-page-height: clamp(260px, calc(100dvh - 178px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), calc((100vw - 24px) * 1.4142));
    --preview-page-width: min(calc(100vw - 24px), calc(var(--preview-page-height) * 0.7070707));
    align-content: center;
    height: var(--preview-page-height);
    max-height: var(--preview-page-height);
    gap: 0;
    overflow: hidden;
  }

  body.mobile-preview-open.mobile-editor-open .print-area {
    --preview-page-height: clamp(210px, calc(100dvh - 320px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), calc((100vw - 24px) * 1.4142));
  }

  body.mobile-preview-open .print-area.preview-paged {
    height: var(--preview-page-height);
  }

  body.mobile-preview-open .print-area.preview-paged .page.is-preview-active,
  body.mobile-preview-open .print-area.preview-paged .page.coloring-page.is-preview-active {
    width: 793.7008px;
    min-width: 793.7008px;
    max-width: none;
    height: 1122.5197px;
    min-height: 1122.5197px;
    max-height: none;
    aspect-ratio: auto;
    zoom: var(--mobile-page-scale, 0.4);
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  body.mobile-preview-open .page {
    box-shadow: 0 10px 28px rgba(34, 39, 47, 0.18);
  }

  body.mobile-preview-open .preview-lower-actions {
    min-height: 42px;
    justify-content: flex-end;
  }

  body.mobile-preview-open #preview-print-button,
  body.mobile-preview-open #keep-edit-button,
  body.mobile-preview-open #revert-edit-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.74rem;
  }

  body.mobile-preview-open .recent-panel {
    display: none;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 5;
    min-height: 0;
    max-height: min(56dvh, 420px);
    border-color: rgba(19, 124, 114, 0.28);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 50px rgba(34, 39, 47, 0.22);
  }

  body.mobile-preview-open.mobile-recent-open .recent-panel {
    display: grid;
  }

  body.mobile-preview-open .recent-list {
    max-height: min(40dvh, 300px);
  }

  body.mobile-preview-open .mobile-editor-dock {
    position: relative;
    z-index: 4;
    display: none;
    gap: 12px;
    margin-top: 8px;
    border: 1px solid rgba(19, 124, 114, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 36px rgba(34, 39, 47, 0.16);
    padding: 10px;
  }

  body.mobile-preview-open.mobile-editor-open .mobile-editor-dock {
    display: grid;
  }

  .mobile-tool-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(78px, 92px);
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .mobile-tool-strip::-webkit-scrollbar {
    display: none;
  }

  button.mobile-tool {
    display: grid;
    justify-items: center;
    gap: 5px;
    min-height: 70px;
    border: 1px solid #d9d1ea;
    background: #fff;
    color: #39414d;
    box-shadow: none;
    padding: 8px 7px;
    font-size: 0.7rem;
    line-height: 1.05;
    white-space: normal;
  }

  button.mobile-tool.is-active {
    border: 0;
    background: linear-gradient(135deg, #8a4fd1, #5c3ca3);
    color: #fff;
  }

  button.mobile-tool.is-active .mobile-tool-icon {
    color: #fff;
  }

  .mobile-tool-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 30px;
    height: 24px;
    color: #5c3ca3;
    font-size: 0.72rem;
    font-weight: 900;
  }

  .icon-scale::before,
  .icon-roundness::before {
    content: "";
    width: 21px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 2px;
  }

  .icon-scale::after {
    content: "";
    position: absolute;
    width: 27px;
    border-top: 2px solid currentColor;
    transform: rotate(-32deg);
  }

  .icon-ai-scale {
    border: 2px solid currentColor;
    border-radius: 3px;
  }

  .icon-y-axis::before {
    content: "";
    height: 23px;
    border-left: 2px solid currentColor;
  }

  .icon-y-axis::after {
    content: "";
    position: absolute;
    top: 0;
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(45deg);
  }

  .icon-font {
    border: 2px solid currentColor;
    border-radius: 3px;
    font-size: 0.68rem;
  }

  .icon-opacity::before {
    content: "%";
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .icon-thickness::before {
    content: "";
    width: 25px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
  }

  .icon-roundness::before {
    border-radius: 8px;
  }

  .mobile-editor-slider,
  .mobile-editor-select {
    display: grid;
    gap: 8px;
  }

  .mobile-editor-select[hidden] {
    display: none;
  }

  .mobile-editor-slider span,
  .mobile-editor-select span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: #39414d;
    font-size: 0.84rem;
    font-weight: 900;
  }

  .mobile-editor-slider input,
  .mobile-editor-select select {
    width: 100%;
    accent-color: #6d46b1;
  }

  .mobile-editor-select select {
    height: min(152px, 22dvh);
    min-height: 0;
    max-height: 152px;
    overflow-y: auto;
    border: 1px solid #d9d1ea;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    color: #39414d;
    font-weight: 800;
  }

  .mobile-editor-select option {
    min-height: 35px;
    padding: 8px 10px;
  }
}
@media (max-width: 980px) {
  html,
  body {
    height: 100%;
  }

  body:not(.mobile-preview-open) {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .app-header {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    min-height: 100vh;
    min-height: 100dvh;
    width: min(100% - 20px, 460px);
    padding: calc(14px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
  }

  body.mobile-step-auth:not(.mobile-preview-open) .app-brand {
    text-align: center;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .app-brand h1 {
    font-size: 1.75rem;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .welcome-message,
  body.mobile-step-auth:not(.mobile-preview-open) .beta-token-card,
  body.mobile-step-auth:not(.mobile-preview-open) .app-shell {
    display: none;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .header-account {
    display: grid;
    grid-template-columns: 1fr;
    align-self: center;
    width: 100%;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .auth-card,
  body.mobile-step-auth:not(.mobile-preview-open) .header-auth {
    width: 100%;
    min-width: 0;
  }

  body.mobile-step-auth:not(.mobile-preview-open) .header-auth {
    grid-template-columns: 1fr;
  }

  body.mobile-step-home:not(.mobile-preview-open) .app-header,
  body.mobile-step-words:not(.mobile-preview-open) .app-header,
  body.mobile-step-options:not(.mobile-preview-open) .app-header {
    width: min(100% - 18px, 640px);
    min-height: 0;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  body.mobile-step-words:not(.mobile-preview-open) .header-account,
  body.mobile-step-options:not(.mobile-preview-open) .header-account {
    display: none;
  }

  body.mobile-step-home:not(.mobile-preview-open) .app-brand h1,
  body.mobile-step-words:not(.mobile-preview-open) .app-brand h1,
  body.mobile-step-options:not(.mobile-preview-open) .app-brand h1 {
    font-size: 1.45rem;
  }

  body.mobile-step-home:not(.mobile-preview-open) .welcome-message,
  body.mobile-step-words:not(.mobile-preview-open) .welcome-message,
  body.mobile-step-options:not(.mobile-preview-open) .welcome-message {
    margin-top: 5px;
    font-size: 0.82rem;
  }

  body.mobile-step-home:not(.mobile-preview-open) .app-shell,
  body.mobile-step-words:not(.mobile-preview-open) .app-shell,
  body.mobile-step-options:not(.mobile-preview-open) .app-shell {
    display: block;
    width: min(100% - 18px, 640px);
    height: calc(100vh - 78px - env(safe-area-inset-top));
    height: calc(100dvh - 78px - env(safe-area-inset-top));
    padding: 9px 0 calc(10px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  body.mobile-step-home:not(.mobile-preview-open) .controls,
  body.mobile-step-home:not(.mobile-preview-open) .preview-panel,
  body.mobile-step-words:not(.mobile-preview-open) .preview-panel,
  body.mobile-step-options:not(.mobile-preview-open) .preview-panel {
    display: none;
  }

  body.mobile-step-words:not(.mobile-preview-open) .controls,
  body.mobile-step-options:not(.mobile-preview-open) .controls {
    display: block;
    height: 100%;
    max-height: none;
    padding: 18px;
    overflow: hidden;
  }

  body.mobile-step-words:not(.mobile-preview-open) #wordsearch-form,
  body.mobile-step-options:not(.mobile-preview-open) #wordsearch-form {
    display: grid;
    height: 100%;
    min-height: 0;
    gap: 12px;
    overflow: hidden;
  }

  body.mobile-step-words:not(.mobile-preview-open) #wordsearch-form {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  body.mobile-step-options:not(.mobile-preview-open) #wordsearch-form {
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  }

  body.mobile-step-words:not(.mobile-preview-open) .mobile-options-step:not(#status),
  body.mobile-step-words:not(.mobile-preview-open) .builder-generated-only,
  body.mobile-step-options:not(.mobile-preview-open) .mobile-title-step,
  body.mobile-step-options:not(.mobile-preview-open) .builder-generated-only {
    display: none !important;
  }

  body.mobile-step-words:not(.mobile-preview-open) .mobile-words-continue {
    display: block;
    min-height: 50px;
    font-size: 1rem;
  }

  body.mobile-step-words:not(.mobile-preview-open) .field,
  body.mobile-step-options:not(.mobile-preview-open) .field {
    gap: 7px;
  }

  body.mobile-step-words:not(.mobile-preview-open) #puzzle-title,
  body.mobile-step-options:not(.mobile-preview-open) select {
    min-height: 50px;
    padding: 0 14px;
    font-size: 1rem;
  }

  body.mobile-step-words:not(.mobile-preview-open) .words-field {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
  }

  body.mobile-step-words:not(.mobile-preview-open) .words-heading {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 10px;
  }

  body.mobile-step-words:not(.mobile-preview-open) .words-heading small,
  body.mobile-step-words:not(.mobile-preview-open) .words-helper {
    font-size: 0.74rem;
    line-height: 1.25;
  }

  body.mobile-step-words:not(.mobile-preview-open) button.generate-words-button {
    width: auto;
    min-height: 42px;
    padding: 0 10px;
    font-size: 0.74rem;
    line-height: 1.05;
    white-space: normal;
  }

  body.mobile-step-words:not(.mobile-preview-open) #words {
    height: 100%;
    min-height: 0;
    resize: none;
    overflow: auto;
    font-size: 1rem;
    line-height: 1.35;
  }

  body.mobile-step-words:not(.mobile-preview-open) .word-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    font-size: 0.8rem;
  }

  body.mobile-step-options:not(.mobile-preview-open) .form-grid {
    display: block;
  }

  body.mobile-step-options:not(.mobile-preview-open) .direction-field {
    min-height: 0;
    overflow: auto;
    padding: 13px;
  }

  body.mobile-step-options:not(.mobile-preview-open) .direction-field legend {
    font-size: 0.95rem;
  }

  body.mobile-step-options:not(.mobile-preview-open) .direction-field label {
    min-height: 42px;
    padding: 8px 9px;
    font-size: 0.78rem;
    line-height: 1.15;
  }

  body.mobile-step-options:not(.mobile-preview-open) .checkbox-row {
    min-height: 42px;
    padding: 0 12px;
  }

  body.mobile-step-options:not(.mobile-preview-open) .status {
    min-height: 18px;
    margin: 0;
    font-size: 0.78rem;
  }

  body.mobile-step-options:not(.mobile-preview-open) .fixed-builder-actions {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.mobile-step-options:not(.mobile-preview-open) .fixed-builder-actions button {
    min-height: 54px;
    padding: 7px 6px;
    font-size: 0.75rem;
    line-height: 1.05;
    white-space: normal;
  }

  body.mobile-step-options:not(.mobile-preview-open) .fixed-builder-actions button small {
    display: none;
  }
}
@media (max-width: 980px) {
  body:not(.mobile-preview-open) .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    width: min(100% - 16px, 640px);
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  body:not(.mobile-preview-open) .app-brand h1 {
    font-size: 1.26rem;
    line-height: 1.05;
  }

  body:not(.mobile-preview-open) .welcome-message {
    max-width: 52vw;
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.18;
  }

  body:not(.mobile-preview-open) .header-account,
  body.mobile-step-words:not(.mobile-preview-open) .header-account,
  body.mobile-step-options:not(.mobile-preview-open) .header-account {
    display: grid;
    grid-template-columns: minmax(68px, 84px) minmax(104px, 148px);
    justify-content: end;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
  }

  body:not(.mobile-preview-open) .beta-token-card {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 0;
    gap: 3px;
    padding: 6px 5px;
  }

  body:not(.mobile-preview-open) .beta-token-card span {
    font-size: 0.56rem;
    letter-spacing: 0;
  }

  body:not(.mobile-preview-open) .beta-token-card strong {
    font-size: 1.05rem;
  }

  body:not(.mobile-preview-open) .beta-token-card .buy-tokens-button {
    min-height: 30px;
    padding: 3px 4px;
    font-size: 0.62rem;
    line-height: 1.05;
    white-space: normal;
  }

  body:not(.mobile-preview-open) .header-auth {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 6px;
    border-color: rgba(19, 124, 114, 0.18);
    background: rgba(255, 255, 255, 0.94);
    padding: 8px;
  }

  body:not(.mobile-preview-open) .header-auth > div:first-child,
  body:not(.mobile-preview-open) .header-auth .desktop-login-form {
    display: none;
  }

  body:not(.mobile-preview-open) .mobile-account-actions {
    display: grid;
    gap: 6px;
  }

  body:not(.mobile-preview-open) .mobile-account-actions p {
    margin: 0;
    color: #39414d;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.12;
    overflow-wrap: anywhere;
    text-align: center;
  }

  body:not(.mobile-preview-open) .mobile-account-buttons {
    grid-template-columns: 1fr;
  }

  body:not(.mobile-preview-open) .mobile-account-buttons button,
  body:not(.mobile-preview-open) .header-auth #sign-out-button,
  body:not(.mobile-preview-open) .mobile-settings-button {
    width: 100%;
    min-height: 34px;
    padding: 4px 7px;
    font-size: 0.68rem;
    line-height: 1.05;
    white-space: normal;
  }

  body.mobile-step-home:not(.mobile-preview-open) .app-shell,
  body.mobile-step-words:not(.mobile-preview-open) .app-shell,
  body.mobile-step-options:not(.mobile-preview-open) .app-shell {
    height: calc(100vh - 88px - env(safe-area-inset-top));
    height: calc(100dvh - 88px - env(safe-area-inset-top));
  }

  .auth-modal-panel {
    width: min(100% - 22px, 420px);
    padding: 22px;
  }

  .settings-dialog {
    padding: 10px;
  }

  .settings-panel {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .settings-header {
    padding: 17px 17px 13px;
  }

  .settings-content {
    padding: 0 17px 18px;
  }
}

@media (max-width: 390px) {
  body:not(.mobile-preview-open) .header-account,
  body.mobile-step-words:not(.mobile-preview-open) .header-account,
  body.mobile-step-options:not(.mobile-preview-open) .header-account {
    grid-template-columns: 68px minmax(100px, 126px);
  }

  body:not(.mobile-preview-open) .app-brand h1 {
    font-size: 1.14rem;
  }
}
@page {
  size: A4 portrait;
  margin: 0;
}

.token-shop-dialog {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 18px;
}

.token-shop-dialog[hidden] {
  display: none;
}

.token-shop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 36, 46, 0.5);
}

.token-shop-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border: 1px solid #d4dfdf;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 26px;
}

.token-shop-panel h2 {
  margin: 2px 0 8px;
  font-size: 1.55rem;
}

.token-shop-intro {
  margin: 0 34px 20px 0;
  color: var(--muted);
  line-height: 1.45;
}

.token-shop-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.token-shop-close:hover:not(:disabled) {
  background: #f4f8f7;
}

.token-pack-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.token-pack {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  min-width: 0;
  border: 1px solid #cfdcda;
  border-radius: 6px;
  background: #f8fbfa;
  padding: 16px;
}

.token-pack-name {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.token-pack strong {
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.1;
}

.token-pack-uses {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.token-pack button {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  background: #202124;
  color: #fff;
}

.token-pack button:hover:not(:disabled) {
  background: #000;
}

.token-shop-loading {
  grid-column: 1 / -1;
  margin: 12px 0;
  color: var(--muted);
  text-align: center;
}

.token-shop-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.token-shop-status.error {
  color: #b43d35;
}

.token-shop-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 680px) {
  .token-shop-panel {
    width: min(100%, 520px);
    padding: 22px;
  }

  .token-pack-list {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 82%);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }

  .token-pack {
    scroll-snap-align: start;
  }
}
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.confirm-dialog[hidden] {
  display: none;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 36, 46, 0.44);
}

.confirm-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  border: 1px solid rgba(19, 124, 114, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(27, 37, 52, 0.24);
  padding: 22px;
}

.confirm-dialog-panel h3 {
  margin: 4px 0 10px;
  font-size: 1.2rem;
}

.confirm-dialog-panel p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.confirm-dialog-actions .danger-confirm {
  border-color: #a63b34;
  background: linear-gradient(135deg, #c84e44, #a63b34);
  color: #fff;
}

.confirm-dialog-actions .danger-confirm:hover:not(:disabled) {
  background: linear-gradient(135deg, #b9433b, #922f2b);
}
@media print {
  body {
    background: #fff;
  }

  body.mobile-preview-open,
  body.mobile-preview-open .app-shell,
  body.mobile-preview-open .preview-panel,
  body.mobile-preview-open .preview-content,
  body.mobile-preview-open .preview-main,
  body.mobile-preview-open .print-area,
  body.mobile-preview-open .print-area.preview-paged {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.mobile-preview-open .app-header,
  body.mobile-preview-open .controls,
  body.mobile-preview-open .mobile-preview-topbar,
  body.mobile-preview-open .mobile-editor-dock,
  body.mobile-preview-open .preview-toolbar,
  body.mobile-preview-open .preview-lower-actions,
  body.mobile-preview-open .recent-panel,
  body.mobile-preview-open .confirm-dialog,
  body.mobile-preview-open .token-shop-dialog {
    display: none !important;
  }

  .app-header,
  .controls,
  .preview-toolbar,
  .recent-panel,
  .preview-lower-actions,
  .confirm-dialog,
  .token-shop-dialog {
    display: none;
  }

  .app-shell,
  .preview-panel,
  .preview-content,
  .print-area {
    display: block;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .print-area.preview-paged {
    display: block;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .print-area.preview-paged .page,
  .print-area.preview-paged .page.is-preview-active {
    display: grid !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  .print-area.preview-paged .page.coloring-page,
  .print-area.preview-paged .page.coloring-page.is-preview-active {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  .preview-panel {
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .page {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    border-radius: 0;
    box-shadow: none;
    padding: 14mm 15mm;
    zoom: 1 !important;
    page-break-after: always;
  }

  .page.coloring-page {
    padding: 0;
  }

  .coloring-sheet {
    height: 297mm;
    min-height: 297mm;
    padding: 0;
  }

  .coloring-sheet.has-ai-background-art {
    position: relative;
    inset: auto;
    min-height: 297mm;
    height: 297mm;
  }

  .coloring-title,
  .ai-finished-worksheet,
  .coloring-word-box,
  .word-list-box {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .page:last-child {
    page-break-after: auto;
  }

  .grid {
    width: 170mm;
    max-width: 170mm;
  }

  .answer-page .grid {
    width: 158mm;
    max-width: 158mm;
  }

  .cell {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .coloring-sheet.has-ai-background-art .coloring-foreground {
    top: 50% !important;
    left: 50% !important;
    width: 52% !important;
    transform: translate(-50%, calc(-50% + var(--puzzle-y-offset, 0%))) scale(var(--puzzle-scale, 1)) !important;
  }

  .coloring-sheet.has-ai-background-art .coloring-center .grid {
    width: 100% !important;
    max-width: none !important;
    background: rgba(255, 255, 255, 0.94) !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .coloring-sheet.has-ai-background-art .coloring-word-box {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.94) !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .coloring-sheet.has-ai-background-art .cell {
    background: transparent !important;
  }

  .coloring-sheet.has-ai-background-art .grid-full .cell,
  .coloring-sheet.has-ai-background-art .grid-full-rounded .cell {
    border-right: var(--puzzle-cell-line-width, 1px) solid rgba(34, 39, 47, 0.32);
    border-bottom: var(--puzzle-cell-line-width, 1px) solid rgba(34, 39, 47, 0.32);
  }
}

@media (max-width: 980px) {
  body.mobile-step-home:not(.mobile-preview-open) {
    overflow: hidden;
  }

  body.mobile-step-home:not(.mobile-preview-open) .app-brand {
    display: grid;
    gap: 7px;
  }

  body.mobile-step-home:not(.mobile-preview-open) .mobile-home-button,
  body.mobile-step-words:not(.mobile-preview-open) .mobile-home-button,
  body.mobile-step-options:not(.mobile-preview-open) .mobile-home-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    min-height: 32px;
    padding: 0 13px;
    font-size: 0.78rem;
  }

  body.mobile-step-home:not(.mobile-preview-open) .mobile-home-button {
    display: none;
  }

  body.mobile-step-home:not(.mobile-preview-open) .mobile-home-screen {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 13px;
    height: 100%;
    max-height: none;
    padding: 18px;
    overflow: hidden;
  }

  .mobile-home-copy h2 {
    margin: 0 0 10px;
    color: #202833;
    font-size: clamp(1.55rem, 8vw, 2.25rem);
    line-height: 1.04;
  }

  .mobile-home-copy p:last-child {
    margin: 0;
    color: #5e6977;
    font-size: 0.95rem;
    line-height: 1.4;
  }


  .mobile-home-actions {
    display: grid;
    gap: 9px;
  }

  .mobile-recent-capacity-message {
    margin: 0;
    border-left: 4px solid #b9433b;
    background: #fff2f0;
    padding: 9px 10px;
    color: #8f2f2a;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.35;
  }

  .mobile-recent-capacity-message[hidden] {
    display: none;
  }

  .mobile-home-actions > button,
  .mobile-home-auth-actions button {
    min-height: 48px;
    font-size: 0.95rem;
  }

  .mobile-home-auth-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-home-auth-actions[hidden],
  .mobile-home-recent[hidden] {
    display: none !important;
  }

  .mobile-home-recent {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 0;
  }

  .mobile-home-recent-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-recent-count {
    flex: 0 0 auto;
    color: #137c72;
    font-size: 0.92rem;
    font-weight: 900;
  }

  .mobile-home-recent h3 {
    margin: 0;
    color: #2b333e;
    font-size: 1.05rem;
  }

  .mobile-home-recent-list,
  body.mobile-preview-open .recent-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 146px);
    max-height: none;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px 0;
    scroll-snap-type: x proximity;
  }

  .mobile-home-recent-list .recent-item,
  body.mobile-preview-open .recent-list .recent-item {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 0;
    padding: 7px;
    scroll-snap-align: start;
  }

  .mobile-home-recent-list .recent-item.is-active,
  body.mobile-preview-open .recent-list .recent-item.is-active {
    border-color: #137c72;
    background: #f2fffb;
    box-shadow: inset 0 0 0 2px #137c72;
  }

  .mobile-home-recent-list .recent-item strong,
  body.mobile-preview-open .recent-list .recent-item strong {
    text-align: center;
  }

  .recent-thumbnail {
    display: block;
    width: 100%;
    max-width: 112px;
    aspect-ratio: 210 / 297;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(45, 51, 61, 0.18);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(34, 39, 47, 0.12);
  }

  .recent-thumbnail .recent-thumbnail-page {
    display: grid;
    width: 793.7008px;
    min-width: 793.7008px;
    max-width: none;
    height: 1122.5197px;
    min-height: 1122.5197px;
    max-height: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    aspect-ratio: auto;
    zoom: 0.141111;
    pointer-events: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  .recent-thumbnail .recent-thumbnail-page.coloring-page {
    display: block;
  }

  .mobile-home-recent-list .recent-item-title,
  body.mobile-preview-open .recent-list .recent-item-title {
    display: block;
    width: 100%;
    overflow: hidden;
    padding: 2px 2px 1px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-recent-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-recent-actions[hidden] {
    display: none !important;
  }

  .mobile-recent-actions button {
    min-height: 42px;
    font-size: 0.82rem;
  }

  .mobile-recent-actions .danger-action:not(:disabled) {
    border-color: rgba(185, 67, 59, 0.28);
    color: #922f2b;
  }
}
