:root {
    color-scheme: light;
    --paper: #f7f4ed;
    --paper-deep: #eee9de;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --ink: #1d2925;
    --muted: #68746f;
    --line: #d9ddd6;
    --line-strong: #bcc6be;
    --forest: #204f42;
    --forest-deep: #153b32;
    --mint: #dceee5;
    --mint-strong: #b8dccb;
    --coral: #e86f51;
    --coral-deep: #b84831;
    --amber: #f4c969;
    --hard: #f0a33a;
    --hard-ink: #4d2d04;
    --impossible: #7952a8;
    --impossible-deep: #5e3b89;
    --danger: #b23a35;
    --danger-soft: #f8e3df;
    --info-soft: #e8eef6;
    --info: #355a82;
    --shadow: 0 16px 42px rgba(26, 50, 42, 0.09);
    --shadow-small: 0 7px 20px rgba(26, 50, 42, 0.08);
    --radius-large: 24px;
    --radius-medium: 16px;
    --radius-small: 11px;
    --content-width: 1120px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 0;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% -4%, rgba(244, 201, 105, 0.23), transparent 30rem),
        radial-gradient(circle at 95% 10%, rgba(184, 220, 203, 0.32), transparent 32rem),
        var(--paper);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button,
a,
input,
textarea,
[draggable="true"] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(232, 111, 81, 0.5);
    outline-offset: 3px;
}

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

.app-shell {
    width: min(100%, var(--content-width));
    margin: 0 auto;
    padding: 14px 14px 56px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px 14px;
}

.brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: var(--forest);
    box-shadow: var(--shadow-small);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1rem;
    line-height: 1.15;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.74rem;
}

.header-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.save-status {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 253, 248, 0.84);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8a9690;
}

.save-status.is-saved .status-dot {
    background: #2d946b;
}

.save-status.is-saving .status-dot,
.save-status.is-loading .status-dot,
.save-status.is-unsaved .status-dot {
    background: #d39a22;
    animation: pulse 1s ease-in-out infinite alternate;
}

.save-status.is-offline .status-dot,
.save-status.is-conflict .status-dot {
    background: var(--danger);
}

.tabs {
    position: sticky;
    z-index: 20;
    top: 8px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(217, 221, 214, 0.9);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.92);
    box-shadow: var(--shadow-small);
    backdrop-filter: blur(14px);
}

.tab {
    min-width: 0;
    min-height: 48px;
    padding: 7px 3px;
    border: 0;
    border-radius: 13px;
    color: var(--muted);
    background: transparent;
    font-size: 0.68rem;
    font-weight: 760;
    cursor: pointer;
}

.tab span {
    display: block;
    height: 18px;
    margin-bottom: 1px;
    color: var(--forest);
    font-size: 0.9rem;
    font-weight: 850;
}

.tab.is-active {
    color: #fff;
    background: var(--forest);
}

.tab.is-active span {
    color: var(--amber);
}

.panel {
    padding-top: 34px;
}

.panel.is-hidden {
    display: none;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h1,
.section-heading h2,
.section-heading p,
.result-header h2 {
    margin-top: 0;
}

.section-heading h1 {
    margin-bottom: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 650;
    letter-spacing: -0.045em;
    line-height: 1;
}

.section-heading > p:last-child,
.section-heading > div > p:last-child {
    max-width: 700px;
    margin-bottom: 0;
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--coral-deep);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.edit-heading-row,
.history-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 780;
    line-height: 1.15;
    cursor: pointer;
    transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.button:not(:disabled):active {
    transform: translateY(1px);
}

.button-compact {
    min-height: 44px;
    padding: 8px 11px;
    font-size: 0.78rem;
}

.button-secondary {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--surface);
}

.button-secondary:not(:disabled):hover {
    border-color: var(--forest);
    background: var(--mint);
}

.button-dark {
    color: #fff;
    background: var(--forest);
}

.button-dark:not(:disabled):hover {
    background: var(--forest-deep);
}

.button-accent {
    color: #fff;
    background: var(--coral);
}

.button-accent:not(:disabled):hover {
    background: var(--coral-deep);
}

.button-danger {
    color: #fff;
    background: var(--danger);
}

.level-jump {
    width: 154px;
}

.level-jump label,
.search-field span,
.word-search-card > label,
.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 760;
}

.input-action,
.word-add-row {
    display: flex;
    gap: 7px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    color: var(--ink);
    background: var(--surface-strong);
}

input {
    min-height: 46px;
    padding: 9px 12px;
}

textarea {
    min-height: 142px;
    padding: 13px 14px;
    line-height: 1.55;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--forest);
}

.level-jump input {
    min-width: 0;
}

.level-nav {
    display: grid;
    grid-template-columns: minmax(92px, 1fr) minmax(100px, 1fr) minmax(92px, 1fr);
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.nav-level-button {
    padding-inline: 8px;
    font-size: 0.78rem;
}

.level-position {
    min-width: 0;
    text-align: center;
}

.level-position strong,
.level-position span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.level-position strong {
    font-size: 0.9rem;
}

.level-position span {
    color: var(--muted);
    font-size: 0.7rem;
}

.puzzle-card,
.readonly-card,
.toolbar-card,
.word-search-card,
.history-summary {
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.puzzle-card {
    overflow: hidden;
}

.puzzle-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 18px;
    color: #fff;
    background: var(--forest);
}

.puzzle-banner strong {
    display: block;
    margin-bottom: 2px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 620;
    letter-spacing: -0.02em;
}

.puzzle-banner small {
    color: rgba(255, 255, 255, 0.72);
}

.difficulty-badge,
.source-chip,
.readonly-badge,
.removal-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 850;
    white-space: nowrap;
}

.difficulty-badge {
    color: var(--forest-deep);
    background: var(--amber);
}

.difficulty-badge.is-hard {
    color: var(--hard-ink);
    background: var(--hard);
}

.difficulty-badge.is-impossible {
    color: #fff;
    background: var(--impossible);
}

.difficulty-badge.is-beginner {
    color: var(--forest-deep);
    background: var(--mint-strong);
}

.puzzle-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.removal-badge {
    color: #fff;
    background: var(--danger);
}

.puzzle-body {
    padding: 18px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 22px;
}

.metric {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--paper);
}

.metric span,
.metric strong {
    display: block;
}

.metric span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.metric strong {
    font-size: 1.12rem;
}

.scramble-section {
    padding: 18px 0 22px;
    border-block: 1px solid var(--line);
}

.scramble-heading {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.scramble-heading > div,
.definition-heading > div {
    min-width: 0;
}

.icon-button {
    width: 46px;
    height: 46px;
    min-height: 46px;
    flex: 0 0 46px;
    padding: 0;
}

.icon-button svg {
    display: block;
    width: 23px;
    height: 23px;
}

.icon-button-small {
    width: 38px;
    height: 38px;
    min-height: 38px;
    flex-basis: 38px;
    border-radius: 10px;
}

.icon-button-small svg {
    width: 19px;
    height: 19px;
}

button.icon-button:disabled {
    border-color: #cfd3cf;
    color: #89918d;
    background: #e3e4e1;
    box-shadow: none;
    opacity: 1;
}

.scramble-heading h2,
.definition-section h2 {
    margin: 0 0 3px;
    font-size: 1rem;
}

.scramble-heading p,
.definition-section p {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.letter-tiles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(5px, 1.8vw, 9px);
    min-height: 58px;
}

.letter-tile {
    display: grid;
    width: clamp(44px, 10.8vw, 58px);
    height: clamp(50px, 12.2vw, 64px);
    place-items: center;
    padding: 0;
    border: 2px solid var(--forest);
    border-radius: 13px;
    color: var(--forest-deep);
    background: var(--surface-strong);
    box-shadow: 0 5px 0 var(--mint-strong);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 6vw, 1.85rem);
    font-weight: 700;
    text-transform: uppercase;
    cursor: grab;
    user-select: none;
    touch-action: manipulation;
}

.letter-tile.is-selected {
    border-color: var(--coral);
    color: var(--coral-deep);
    background: #fff4ee;
    box-shadow: 0 5px 0 #f2b6a5;
    transform: translateY(-2px);
}

.letter-tile.is-dragging {
    opacity: 0.45;
}

.letter-tile:disabled {
    opacity: 1;
    cursor: default;
}

.definition-section {
    padding-top: 20px;
}

.definition-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.definition-section textarea {
    margin-top: 11px;
}

.definition-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.7rem;
}

.current-arrange-panel {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
}

.current-arrange-copy .eyebrow {
    margin: 0 0 4px;
}

.current-arrange-copy h2 {
    margin: 0 0 3px;
    font-size: 1rem;
}

.current-arrange-copy > p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.current-arrange-actions {
    margin-top: 12px;
}

.readonly-card {
    padding: 22px;
}

.readonly-card.is-lightning {
    color: #392b0e;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.62), transparent),
        #f8dd8f;
    border-color: #e0b94d;
}

.readonly-card h2 {
    margin: 14px 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.75rem;
    line-height: 1.1;
}

.readonly-card p {
    margin-bottom: 0;
    color: var(--muted);
}

.readonly-card.is-lightning p {
    color: #66521f;
}

.readonly-badge {
    color: var(--info);
    background: var(--info-soft);
}

.readonly-definition {
    margin-top: 18px;
    padding: 14px;
    border-radius: 13px;
    background: var(--paper);
}

.readonly-definition span,
.readonly-definition strong {
    display: block;
}

.readonly-definition span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
}

.loading-card,
.empty-state {
    display: grid;
    min-height: 220px;
    place-items: center;
    align-content: center;
    padding: 24px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-large);
    color: var(--muted);
    text-align: center;
    background: rgba(255, 253, 248, 0.55);
}

.loader {
    width: 26px;
    height: 26px;
    border: 3px solid var(--mint-strong);
    border-top-color: var(--forest);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.toolbar-card,
.word-search-card {
    padding: 16px;
    margin-bottom: 18px;
}

.toolbar-card {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.search-field {
    flex: 1;
}

.result-count {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.arrange-list,
.word-results,
.history-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.arrange-list {
    display: grid;
    gap: 8px;
}

.arrange-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-medium);
    background: var(--surface);
    box-shadow: var(--shadow-small);
}

.arrange-row.is-dragging {
    opacity: 0.45;
}

.arrange-row.is-drop-target {
    border-color: var(--coral);
    background: #fff5ef;
}

.drag-handle {
    display: grid;
    min-height: 48px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--muted);
    background: var(--paper);
    font-weight: 900;
    cursor: grab;
}

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

.arrange-copy {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.arrange-word {
    min-width: 0;
}

.arrange-word-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.arrange-word strong,
.arrange-word span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arrange-word strong {
    font-size: 1rem;
    text-transform: lowercase;
}

.arrange-word .arrange-definition {
    color: var(--muted);
    font-size: 0.75rem;
}

.arrange-word .removal-badge {
    display: inline-flex;
    flex: 0 0 auto;
    overflow: visible;
    color: #fff;
    font-size: 0.65rem;
    white-space: nowrap;
}

.level-chip {
    flex: 0 0 auto;
    color: var(--forest);
    font-size: 0.72rem;
    font-weight: 850;
}

.arrange-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.arrange-actions .button {
    min-height: 44px;
    padding: 8px 11px;
    font-size: 0.75rem;
}

.arrange-actions .icon-button {
    padding: 0;
}

.move-form {
    display: flex;
    flex: 1 1 190px;
    gap: 6px;
}

.move-form input {
    min-width: 76px;
    min-height: 44px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 18px;
}

.pagination span {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
    text-align: center;
}

.word-search-card {
    border-color: var(--mint-strong);
    background: linear-gradient(150deg, #fffdf8 40%, #edf7f0);
}

.word-add-row input {
    min-width: 0;
    font-size: 1.05rem;
}

.field-message {
    min-height: 21px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.field-message.is-valid {
    color: #247251;
}

.field-message.is-invalid {
    color: var(--danger);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 10px;
}

.result-header h2 {
    margin-bottom: 0;
    font-size: 1rem;
}

.word-results {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-medium);
    background: var(--surface);
}

.word-result {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.word-result:last-child {
    border-bottom: 0;
}

.word-result strong {
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    text-transform: lowercase;
    white-space: nowrap;
}

.word-result-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.word-result-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.word-result-actions .button {
    min-height: 44px;
}

.word-result.is-pending strong {
    color: var(--coral-deep);
}

.source-chip.is-level {
    color: var(--forest);
    background: var(--mint);
}

.source-chip.is-pending {
    color: var(--coral-deep);
    background: #fbe4dc;
}

.history-heading-row {
    align-items: center;
}

.history-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--line);
}

.history-stat {
    padding: 15px;
    background: var(--surface);
}

.history-stat span,
.history-stat strong {
    display: block;
}

.history-stat span {
    color: var(--muted);
    font-size: 0.7rem;
}

.history-stat strong {
    margin-top: 2px;
    font-size: 1rem;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-medium);
    background: var(--surface);
    box-shadow: var(--shadow-small);
}

.history-group-card {
    overflow: hidden;
    padding: 0;
}

.history-group > summary {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.history-group > summary::-webkit-details-marker {
    display: none;
}

.history-group > summary::after {
    content: "⌄";
    flex: 0 0 auto;
    color: var(--forest);
    font-size: 1.2rem;
    font-weight: 850;
    transition: transform 140ms ease;
}

.history-group[open] > summary {
    border-bottom: 1px solid var(--line);
}

.history-group[open] > summary::after {
    transform: rotate(180deg);
}

.history-group-copy {
    min-width: 0;
    flex: 1;
}

.history-group-summary h2 {
    margin: 0 0 3px;
    font-size: 1rem;
    text-transform: lowercase;
}

.history-count-chip {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    color: var(--forest);
    background: var(--mint);
    font-size: 0.7rem;
    font-weight: 850;
    white-space: nowrap;
}

.history-revision-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.history-revision {
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.history-revision:last-child {
    border-bottom: 0;
}

.history-revision h3 {
    margin: 0 0 3px;
    font-size: 0.88rem;
}

.history-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.history-card-header h2 {
    margin: 0 0 3px;
    font-size: 0.95rem;
}

.history-meta {
    color: var(--muted);
    font-size: 0.7rem;
}

.history-card summary {
    min-height: 44px;
    padding-top: 12px;
    color: var(--forest);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}

.operation-list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0 0 12px;
    list-style: none;
}

.history-card > .operation-list,
.history-revision > .operation-list {
    margin: 10px 0 0;
}

.operation-item {
    overflow-wrap: anywhere;
    padding: 10px;
    border-radius: 10px;
    color: var(--muted);
    background: var(--paper);
    font-size: 0.75rem;
}

.operation-item strong {
    color: var(--ink);
}

.load-more {
    width: 100%;
    margin-top: 14px;
}

.toast-region {
    position: fixed;
    z-index: 80;
    right: 14px;
    bottom: 16px;
    display: grid;
    width: min(360px, calc(100vw - 28px));
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 14px;
    border-radius: 12px;
    color: #fff;
    background: var(--forest-deep);
    box-shadow: var(--shadow);
    font-size: 0.8rem;
    font-weight: 700;
    animation: toast-in 180ms ease-out;
}

.toast.is-error {
    background: var(--danger);
}

.conflict-dialog,
.download-dialog {
    width: min(460px, calc(100% - 28px));
    padding: 0;
    border: 0;
    border-radius: 22px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(19, 42, 34, 0.28);
}

.conflict-dialog::backdrop,
.download-dialog::backdrop {
    background: rgba(17, 36, 30, 0.55);
    backdrop-filter: blur(4px);
}

.conflict-dialog form,
.download-dialog form {
    padding: 24px;
}

.conflict-dialog h2,
.download-dialog h2 {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.75rem;
    line-height: 1.1;
}

.conflict-dialog p:not(.eyebrow),
.download-dialog p:not(.eyebrow) {
    color: var(--muted);
}

.download-options {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.download-option {
    display: block;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: var(--paper);
    text-decoration: none;
}

.download-option:hover {
    border-color: var(--forest);
    background: var(--mint);
}

.download-option strong,
.download-option span {
    display: block;
}

.download-option span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
}

.download-close {
    width: 100%;
    margin-top: 16px;
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 20px;
}

noscript {
    display: block;
    padding: 20px;
    color: var(--danger);
    text-align: center;
}

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

@keyframes pulse {
    to {
        opacity: 0.35;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@media (max-width: 620px) {
    .app-header {
        align-items: flex-start;
    }

    .header-actions {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 5px;
    }

    .save-status {
        min-height: 28px;
        padding-inline: 8px;
    }

    .edit-heading-row,
    .history-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .level-jump {
        width: 100%;
    }

    .level-nav {
        grid-template-columns: 1fr 88px 1fr;
    }

    .puzzle-banner {
        align-items: flex-start;
    }

    .toolbar-card {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .arrange-copy {
        gap: 8px;
    }

    .word-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .word-result-actions {
        width: 100%;
        justify-content: space-between;
    }

    .pagination .button {
        min-width: 0;
        padding-inline: 8px;
        font-size: 0.72rem;
    }
}

@media (max-width: 370px) {
    .app-shell {
        padding-inline: 10px;
    }

    .brand small {
        display: none;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .button-compact {
        padding-inline: 9px;
        font-size: 0.7rem;
    }

    .letter-tiles {
        gap: 4px;
    }

    .letter-tile {
        width: 44px;
    }

    .arrange-row {
        grid-template-columns: 44px minmax(0, 1fr);
        padding: 9px;
    }

    .word-add-row {
        flex-direction: column;
    }
}

@media (min-width: 760px) {
    .app-shell {
        padding: 22px 24px 80px;
    }

    .app-header {
        padding-bottom: 20px;
    }

    .brand-mark {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .brand strong {
        font-size: 1.14rem;
    }

    .brand small {
        font-size: 0.78rem;
    }

    .tabs {
        position: static;
        width: fit-content;
        grid-template-columns: repeat(4, minmax(120px, 1fr));
        margin-inline: auto;
    }

    .tab {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding-inline: 14px;
        font-size: 0.8rem;
    }

    .tab span {
        display: inline;
        height: auto;
        margin: 0;
    }

    .panel {
        padding-top: 54px;
    }

    .puzzle-card {
        display: grid;
        grid-template-columns: minmax(220px, 0.75fr) minmax(0, 2fr);
    }

    .puzzle-banner {
        align-items: flex-start;
        justify-content: flex-start;
        flex-direction: column;
        padding: 26px;
    }

    .puzzle-banner strong {
        margin-top: auto;
        font-size: 2.1rem;
    }

    .puzzle-body {
        padding: 26px;
    }

    .metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .arrange-row {
        grid-template-columns: 54px minmax(0, 1fr);
        padding: 14px;
    }

    .arrange-main {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(350px, 0.8fr);
        align-items: center;
        gap: 20px;
    }

    .arrange-actions {
        justify-content: flex-end;
        margin-top: 0;
    }

    .move-form {
        max-width: 230px;
    }

    .history-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
