:root {
    --color-bg: #ffffff;
    --color-text: #18181b;
    --color-muted: #52525b;
    --color-border: #d4d4d8;
    --color-primary: #1d4ed8;
    --color-primary-hover: #1e40af;
    --color-board: #f7d978;
    --color-board-hover: #fde9a8;
    --color-board-selected: #fbbf24;
    --color-board-legal: #dbeafe;
    --color-success: #166534;
    --color-danger: #b91c1c;
    font-family: Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--color-bg); color: var(--color-text); }
.public-page { display: flex; flex-direction: column; }
.public-page > main { flex: 1 0 auto; }
.public-page > footer { margin-top: auto; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.site-header { border-bottom: 1px solid #e4e4e7; background: #fff; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; width: min(100% - 2rem, 64rem); min-height: 4rem; margin-inline: auto; }
.site-header__inner--wide { width: min(100% - 2rem, 92rem); }
.brand { font-size: 1.125rem; font-weight: 700; text-decoration: none; }
.nav-link { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .75rem; border-radius: .375rem; color: var(--color-primary); font-size: .875rem; font-weight: 700; text-decoration: none; }
.nav-link:hover { background: #eff6ff; }

.home-main { width: min(100% - 2rem, 64rem); margin-inline: auto; padding: 4rem 0 6rem; }
.home-intro { width: min(100%, 42rem); }
.home-intro h1 { margin: 0; font-size: clamp(2.25rem, 7vw, 3.5rem); letter-spacing: -.04em; }
.home-intro p { margin: 1.5rem 0 0; color: var(--color-muted); font-size: clamp(1rem, 3vw, 1.25rem); line-height: 1.8; }
.problem-index { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid #e4e4e7; }
.section-heading h2 { margin: 0; font-size: clamp(1.625rem, 4vw, 2rem); }
.section-heading p { margin: .75rem 0 0; color: var(--color-muted); line-height: 1.7; }
.search-form { display: grid; grid-template-columns: minmax(14rem, 2fr) repeat(2, minmax(9rem, 1fr)) auto; gap: 1rem; align-items: end; margin-top: 2rem; }
.search-form .primary-button { margin-top: 0; }
.search-form__reset { grid-column: 1 / -1; width: fit-content; color: var(--color-primary); font-size: .875rem; font-weight: 700; }
.list-status { margin: 2.5rem 0 1rem; color: var(--color-muted); }
.problem-list { border-top: 1px solid #e4e4e7; }
.problem-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid #e4e4e7; }
.problem-row h3 { margin: 0; font-size: 1.125rem; }
.problem-row h3 a { text-decoration-thickness: 1px; text-underline-offset: .25rem; }
.problem-row p { margin: .5rem 0 0; color: var(--color-muted); font-size: .875rem; line-height: 1.6; }
.problem-row__details { margin: 0 !important; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; border-radius: .375rem; padding: .625rem 1.125rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary-button { margin-top: 2.5rem; border: 1px solid var(--color-primary); background: var(--color-primary); color: #fff; }
.primary-button:hover { background: var(--color-primary-hover); }
.secondary-button { border: 1px solid var(--color-border); background: #fff; color: #27272a; }
.secondary-button:hover { background: #f4f4f5; }
.secondary-button:disabled { cursor: not-allowed; opacity: .5; }
.secondary-button--full { width: 100%; }

.game-main { width: min(100% - 2rem, 70rem); margin-inline: auto; padding: 2.5rem 0 5rem; }
.problem-heading { display: flex; align-items: start; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #e4e4e7; }
.problem-heading h1 { margin: 0; font-size: clamp(1.875rem, 5vw, 2.5rem); letter-spacing: -.03em; }
.problem-meta { margin: .75rem 0 0; color: var(--color-muted); line-height: 1.7; }
.game-layout { display: grid; grid-template-columns: minmax(0, 36rem) minmax(17rem, 1fr); gap: 3rem; align-items: start; margin-top: 2rem; }
.board-column { min-width: 0; }
.shogi-board { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr)); width: 100%; aspect-ratio: 1 / 1.06; overflow: hidden; border-top: 1px solid #44403c; border-left: 1px solid #44403c; background: var(--color-board); }
.board-cell { min-width: 0; min-height: 0; border: 0; border-right: 1px solid #44403c; border-bottom: 1px solid #44403c; background: transparent; color: #18181b; font-size: clamp(1.05rem, 6.5vw, 2.8rem); font-weight: 700; line-height: 1; cursor: pointer; }
.board-cell:hover { background: var(--color-board-hover); }
.board-cell.is-selected { background: var(--color-board-selected); }
.board-cell.is-legal { background: var(--color-board-legal); }
.board-cell.is-hint-source { background: #f8cb68; box-shadow: inset 0 0 0 4px #8f1019; }
.board-cell.is-hint-target { background: #f7aaa4; box-shadow: inset 0 0 0 4px #a80d19; }
.piece--gote { display: inline-block; transform: rotate(180deg); }
.hand-stand { margin: 0 0 1rem; }
.hand-stand:last-child { margin: 1rem 0 0; }
.hand-stand h2 { margin: 0 0 .5rem; font-size: .875rem; }
.hand-pieces { min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid var(--color-border); border-radius: .375rem; color: var(--color-muted); }
.game-panel { border-left: 1px solid #e4e4e7; padding-left: 2rem; }
.game-panel > h2 { margin: 0; font-size: 1.25rem; }
.game-panel > p { color: var(--color-muted); line-height: 1.7; }
.result-message { min-height: 3rem; font-weight: 700; }
.result-message.is-correct { color: var(--color-success); }
.result-message.is-incorrect { color: var(--color-danger); }
.completion-actions { margin-top: 1.25rem; padding: 1.25rem; border: 1px solid #bbf7d0; border-radius: .5rem; background: #f0fdf4; }
.completion-actions h2 { margin: 0; font-size: 1.2rem; }
.completion-actions p { margin: .5rem 0 1rem; color: var(--color-muted); line-height: 1.6; }
.completion-actions__links { display: grid; gap: .65rem; }
.completion-actions__links .primary-button, .completion-actions__links .secondary-button { width: 100%; margin: 0; }
.problem-details { margin: 2rem 0 0; border-top: 1px solid #e4e4e7; }
.problem-details div { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: .875rem 0; border-bottom: 1px solid #e4e4e7; }
.problem-details dt { font-weight: 700; }
.problem-details dd { margin: 0; color: var(--color-muted); }
.explanation { margin-top: 2rem; }
.explanation h2 { font-size: 1.125rem; }
.explanation p { color: var(--color-muted); line-height: 1.8; }
.problem-navigation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid #e4e4e7; }
.notice { padding: 1rem; border: 1px solid var(--color-border); border-radius: .375rem; }
.notice--error { border-color: #fecaca; background: #fef2f2; color: var(--color-danger); }
.notice--success { border-color: #bbf7d0; background: #f0fdf4; color: var(--color-success); }
.preview-banner { margin: 0 0 1.5rem; padding: .75rem 1rem; border-left: 4px solid #2563eb; background: #eff6ff; color: #1e3a8a; font-weight: 700; }
.hint-dialog { width: min(calc(100% - 2rem), 28rem); border: 0; border-radius: .5rem; padding: 1.5rem; box-shadow: 0 1rem 3rem rgb(0 0 0 / .2); }
.hint-dialog::backdrop { background: rgb(0 0 0 / .35); }
.hint-dialog h2 { margin-top: 0; }
.hint-dialog p { line-height: 1.7; }
.hint-dialog__note { color: var(--color-muted); font-size: .875rem; }
.hint-dialog .primary-button { margin-top: 1rem; }
.promotion-choice-dialog { width: min(calc(100% - 2rem), 25rem); border: 0; border-radius: .5rem; padding: 1.5rem; box-shadow: 0 1rem 3rem rgb(0 0 0 / .2); }
.promotion-choice-dialog::backdrop { background: rgb(0 0 0 / .4); }
.promotion-choice-dialog h2 { margin: 0; font-size: 1.35rem; }
.promotion-choice-dialog p { margin: .75rem 0 1.25rem; color: var(--color-muted); line-height: 1.6; }
.promotion-choice-dialog__actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.promotion-choice-dialog__actions .primary-button, .promotion-choice-dialog__actions .secondary-button { width: 100%; margin: 0; }

:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
[hidden] { display: none !important; }

.admin-auth { display: grid; min-height: 100vh; place-items: center; padding: 2rem 1rem; }
.admin-auth__form { width: min(100%, 26rem); }
.admin-auth__form h1 { margin: 0; font-size: 2rem; }
.admin-auth__form > p { color: var(--color-muted); line-height: 1.7; }
.admin-main { width: min(100% - 2rem, 60rem); margin-inline: auto; padding: 2.5rem 0 5rem; }
.admin-heading { padding-bottom: 1.5rem; border-bottom: 1px solid #e4e4e7; }
.admin-heading h1 { margin: 0; font-size: 2.25rem; }
.admin-heading p { color: var(--color-muted); }
.admin-section { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid #e4e4e7; }
.admin-heading + .notice, .notice + .notice { margin-top: 1.5rem; }
.admin-problem-list { margin-top: 1.5rem; border-top: 1px solid #e4e4e7; }
.admin-list-controls { display: grid; grid-template-columns: minmax(11rem, .8fr) minmax(11rem, .8fr) auto auto; gap: 1rem; align-items: end; margin-top: 1.5rem; padding: 1.25rem; border: 1px solid #e4e4e7; border-radius: .35rem; }
.admin-list-controls .form-field { gap: .4rem; }
.admin-list-controls__submit { min-height: 2.75rem; }
.admin-list-controls__reset { align-self: center; color: inherit; font-weight: 700; text-underline-offset: .2em; }
.admin-pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.75rem; }
.admin-pagination a { border: 1px solid currentColor; border-radius: .25rem; padding: .65rem 1rem; color: inherit; font-weight: 700; text-decoration: none; }
.admin-pagination a:hover { background: #a80d19; color: #fff7ed; }
.admin-pagination span { color: var(--color-muted); font-size: .9rem; }
.admin-problem-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; padding: 1.25rem 0; border-bottom: 1px solid #e4e4e7; }
.admin-problem-row__title-line { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.admin-problem-row h3 { margin: 0; font-size: 1.05rem; }
.admin-problem-row p { margin: .5rem 0 0; color: var(--color-muted); font-size: .875rem; line-height: 1.6; }
.admin-problem-row code { overflow-wrap: anywhere; }
.admin-problem-row__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.admin-problem-row__actions form { margin: 0; }
.secondary-button--compact, .danger-button { min-height: 2.25rem; padding: .4rem .7rem; font-size: .8125rem; }
.danger-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #fecaca; border-radius: .375rem; background: #fff; color: var(--color-danger); font-weight: 700; cursor: pointer; }
.danger-button:hover { background: #fef2f2; }
.status-badge { display: inline-flex; border-radius: 999px; padding: .2rem .55rem; font-size: .75rem; font-weight: 700; }
.status-badge--published { background: #dcfce7; color: #166534; }
.status-badge--draft { background: #f4f4f5; color: #52525b; }
.admin-empty { margin-top: 1.5rem; color: var(--color-muted); }
.admin-form { margin-top: 2rem; }
.admin-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.admin-form__wide { grid-column: 1 / -1; }
.form-field { display: grid; gap: .5rem; color: #27272a; font-size: .875rem; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 2.75rem; border: 1px solid var(--color-border); border-radius: .375rem; padding: .625rem .75rem; background: #fff; color: var(--color-text); font-size: 1rem; font-weight: 400; }
.form-field textarea { resize: vertical; line-height: 1.6; }
.primary-button--form { width: 100%; margin-top: 1.5rem; }
.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.primary-button--inline { margin-top: 0; }
.form-help { color: var(--color-muted); font-size: .875rem; line-height: 1.6; }
.section-heading--actions { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }

.editor-page { width: min(100% - 2rem, 92rem); margin-inline: auto; padding: 1.25rem 0 7rem; }
.editor-page .admin-heading { padding-bottom: 1rem; }
.editor-page .admin-heading h1 { font-size: 2rem; }
.editor-page .admin-heading p { margin: .5rem 0 0; }
.problem-editor { margin-top: 1rem; }
.editor-workspace { display: grid; grid-template-columns: minmax(30rem, 1.35fr) minmax(19rem, .9fr) minmax(17rem, .72fr); border: 1px solid var(--color-border); border-radius: .5rem; background: #fff; }
.editor-board-panel, .editor-details-panel, .editor-solution-panel { min-width: 0; padding: 1.25rem; }
.editor-details-panel, .editor-solution-panel { border-left: 1px solid var(--color-border); }
.editor-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.editor-panel-heading h2 { margin: 0; font-size: 1.125rem; }
.editor-panel-heading p { margin: .35rem 0 0; color: var(--color-muted); font-size: .8125rem; line-height: 1.5; }
.editor-step { display: grid; flex: 0 0 1.75rem; height: 1.75rem; place-items: center; border-radius: 50%; background: #eff6ff; color: var(--color-primary); font-size: .8125rem; font-weight: 700; }
.piece-owner-toggle { display: grid; grid-template-columns: repeat(2, 1fr); width: min(100%, 18rem); margin-bottom: .75rem; }
.piece-owner-toggle button { min-height: 2.5rem; border: 1px solid var(--color-border); background: #fff; color: var(--color-text); font-weight: 700; cursor: pointer; }
.piece-owner-toggle button:first-child { border-radius: .375rem 0 0 .375rem; }
.piece-owner-toggle button:last-child { border-left: 0; border-radius: 0 .375rem .375rem 0; }
.piece-owner-toggle button.is-active { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.piece-palette { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .4rem; }
.piece-palette button { display: grid; min-width: 0; min-height: 3.8rem; place-items: center; border: 1px solid #a16207; border-radius: .25rem .25rem .45rem .45rem; background: var(--color-board); color: #18181b; cursor: pointer; }
.piece-palette button span { font-family: serif; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.piece-palette button small { color: #713f12; font-size: .625rem; }
.piece-palette button[aria-pressed="true"] { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.editor-board-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.editor-board-tools button { min-height: 2.25rem; border: 1px solid var(--color-border); border-radius: .375rem; padding: .35rem .65rem; background: #fff; color: #3f3f46; font-size: .8125rem; font-weight: 700; cursor: pointer; }
.editor-board-tools button:hover, .editor-board-tools button.is-active { border-color: #93c5fd; background: #eff6ff; color: var(--color-primary); }
.editor-board-tools button:disabled { cursor: not-allowed; opacity: .45; }
.editor-board-and-hands { display: grid; grid-template-columns: minmax(23rem, 1fr) 11.5rem; gap: 1rem; align-items: start; }
.editor-board-area { min-width: 0; }
.editor-board-wrap { width: 100%; margin-inline: auto; }
.editor-file-labels { display: grid; grid-template-columns: repeat(9, 1fr); padding-right: 1.5rem; text-align: center; font-size: .75rem; font-weight: 700; }
.editor-board-row { display: grid; grid-template-columns: minmax(0, 1fr) 1.5rem; }
.editor-rank-labels { display: grid; grid-template-rows: repeat(9, 1fr); place-items: center; font-size: .75rem; font-weight: 700; }
.editor-shogi-board { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr)); width: 100%; aspect-ratio: 1 / 1.06; overflow: hidden; border-top: 1px solid #44403c; border-left: 1px solid #44403c; background: var(--color-board); }
.editor-board-cell { min-width: 0; min-height: 0; border: 0; border-right: 1px solid #44403c; border-bottom: 1px solid #44403c; background: transparent; color: #18181b; font-family: serif; font-size: clamp(1rem, 3vw, 2rem); font-weight: 700; line-height: 1; cursor: pointer; }
.editor-board-cell:hover { background: var(--color-board-hover); }
.editor-board-cell.is-selected { background: var(--color-board-selected); }
.editor-help { min-height: 1.5rem; margin: .75rem 0 0; color: var(--color-muted); font-size: .8125rem; }
.hand-editor { min-width: 0; border-left: 1px solid #e4e4e7; padding-left: 1rem; }
.hand-editor h3 { margin: 0; font-size: 1rem; }
.hand-editor__heading { display: grid; gap: .65rem; }
.hand-fill-button { width: 100%; min-height: 2.4rem; padding: .45rem .6rem; font-size: .75rem; line-height: 1.35; white-space: normal; }
.hand-editor > p { margin: .35rem 0 1rem; color: var(--color-muted); font-size: .75rem; line-height: 1.5; }
.hand-editor.is-recording { border-color: #a80d19; background: rgb(168 13 25 / .08); box-shadow: 0 0 0 .65rem rgb(168 13 25 / .08); }
.hand-editor.is-recording > p { color: #e7ba73; }
.hand-editor__group { display: grid; gap: .35rem; align-items: start; margin-top: .75rem; }
.hand-editor__group strong { padding-top: .45rem; font-size: .8125rem; }
.hand-editor__rows { display: grid; gap: .3rem; }
.hand-counter { display: grid; grid-template-columns: 1.25rem 1.6rem 1.25rem 1.6rem; justify-content: space-between; align-items: center; border: 1px solid var(--color-border); border-radius: .25rem; overflow: hidden; font-size: .75rem; text-align: center; }
.hand-counter button { height: 1.85rem; border: 0; padding: 0; background: #f4f4f5; color: var(--color-text); cursor: pointer; }
.hand-counter button:hover { background: #e4e4e7; }
.hand-counter output { font-variant-numeric: tabular-nums; }
.editor-fields { display: grid; gap: 1rem; }
.form-field small { color: var(--color-muted); font-size: .75rem; font-weight: 400; line-height: 1.4; }
.editor-record-button { width: 100%; margin: 0; }
.editor-record-button.is-recording { border-color: #b91c1c; background: #b91c1c; }
.editor-record-status { min-height: 3rem; margin: .75rem 0; color: var(--color-muted); font-size: .8125rem; line-height: 1.6; }
.solution-move-list { min-height: 12rem; margin: 0; padding: .5rem 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); list-style: none; }
.solution-move-list li { display: grid; grid-template-columns: 1.75rem 1fr auto; gap: .5rem; align-items: center; padding: .65rem .4rem; border-bottom: 1px solid #f4f4f5; font-size: .875rem; }
.solution-move-list li:last-child { border-bottom: 0; }
.solution-move-list li small { color: var(--color-muted); }
.solution-move-list li.is-empty { display: block; padding: 1rem .4rem; color: var(--color-muted); line-height: 1.6; }
.editor-solution-actions { display: grid; gap: .75rem; margin-top: 1rem; }
.editor-json-details { margin-top: 1rem; border: 1px solid var(--color-border); border-radius: .375rem; padding: 0 1rem 1rem; }
.editor-json-details summary { padding: 1rem 0; font-weight: 700; cursor: pointer; }
.editor-json-details > p { margin-top: 0; color: var(--color-muted); font-size: .8125rem; }
.editor-validation { margin-top: 1rem; }
.editor-submit-bar { position: sticky; z-index: 5; bottom: 0; display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1rem; border-top: 1px solid var(--color-border); padding: 1rem 0; background: rgb(255 255 255 / .96); }
.editor-submit-bar .primary-button, .editor-submit-bar .secondary-button { min-width: 12rem; margin: 0; }
.editor-preview-dialog { width: min(calc(100% - 2rem), 60rem); max-height: calc(100vh - 2rem); border: 0; border-radius: .5rem; padding: 1.5rem; box-shadow: 0 1rem 3rem rgb(0 0 0 / .2); }
.editor-preview-dialog::backdrop { background: rgb(0 0 0 / .4); }
.preview-dialog__heading { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--color-border); padding-bottom: 1rem; }
.preview-dialog__heading h2 { margin: 0; }
.preview-dialog__heading button { width: 2.5rem; height: 2.5rem; border: 0; border-radius: .375rem; background: #f4f4f5; font-size: 1.5rem; cursor: pointer; }
.preview-dialog__body { display: grid; grid-template-columns: minmax(18rem, 1fr) minmax(15rem, .8fr); gap: 2rem; margin: 1.5rem 0; }
.editor-shogi-board--preview .editor-board-cell { cursor: default; }
.preview-dialog__actions { display: flex; justify-content: flex-end; }

/* Public home and problem browser */
.public-container { width: min(100% - 3rem, 92rem); margin-inline: auto; }
.site-header__inner--public { width: min(100% - 3rem, 92rem); }
.public-brand { font-size: 1.35rem; letter-spacing: .04em; }
.public-nav { display: flex; align-self: stretch; gap: 1.25rem; }
.public-nav .nav-link { position: relative; min-height: 4rem; color: var(--color-text); font-size: .925rem; }
.public-nav .nav-link:hover { background: transparent; color: var(--color-primary); }
.public-nav .nav-link.is-current { color: var(--color-primary); }
.public-nav .nav-link.is-current::after { position: absolute; right: .75rem; bottom: -1px; left: .75rem; height: 3px; background: var(--color-primary); content: ""; }

.home-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(24rem, .9fr); gap: clamp(3rem, 7vw, 7rem); align-items: center; width: min(100% - 3rem, 86rem); min-height: 28rem; margin-inline: auto; padding: 2rem 0; }
.home-hero__copy h1 { margin: 0; font-size: clamp(2.7rem, 4vw, 3.6rem); letter-spacing: -.055em; line-height: 1.16; }
.home-hero__copy h1 span { display: inline; }
.home-hero__copy p { margin: 1.5rem 0 0; color: #3f3f46; font-size: clamp(1rem, 1.8vw, 1.3rem); line-height: 1.7; }
.home-hero__actions { display: grid; width: min(100%, 29rem); gap: 1rem; margin-top: 1.75rem; }
.primary-button--hero, .secondary-button--hero { width: 100%; min-height: 4.3rem; margin: 0; font-size: 1.35rem; }
.secondary-button--hero { border-color: var(--color-primary); color: var(--color-primary); }
.home-board-frame { width: min(100%, 29.5rem); justify-self: end; border-radius: .25rem; padding: .5rem .75rem .75rem; background: var(--color-board); box-shadow: 0 .75rem 1.5rem rgb(24 24 27 / .18); }
.home-board-files { display: grid; grid-template-columns: repeat(9, 1fr); padding-right: 1.35rem; text-align: center; font-size: .78rem; font-weight: 700; }
.home-board-row { display: grid; grid-template-columns: minmax(0, 1fr) 1.35rem; }
.home-board-ranks { display: grid; grid-template-rows: repeat(9, 1fr); place-items: center; font-size: .78rem; font-weight: 700; }
.home-shogi-board { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr)); width: 100%; aspect-ratio: 1 / 1.06; border-top: 1px solid #44403c; border-left: 1px solid #44403c; }
.home-shogi-board > span { display: grid; min-width: 0; min-height: 0; place-items: center; border-right: 1px solid #44403c; border-bottom: 1px solid #44403c; font-family: serif; font-size: clamp(1rem, 2.5vw, 2rem); font-weight: 700; }

.difficulty-band { border-block: 1px solid #e4e4e7; }
.difficulty-band__inner { display: grid; grid-template-columns: 12rem minmax(0, 1fr); align-items: center; min-height: 6rem; }
.difficulty-band h2 { margin: 0; font-size: 1.25rem; }
.difficulty-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.difficulty-links a { display: grid; gap: .4rem; min-height: 3.5rem; align-content: center; border-left: 1px solid #e4e4e7; padding: 0 2rem; text-decoration: none; }
.difficulty-links strong { font-size: 1.25rem; }
.difficulty-links span { color: var(--color-primary); font-weight: 700; }
.difficulty-links a:hover strong { color: var(--color-primary); }
.home-content { padding-block: 2rem 3.5rem; }
.ad-slot { display: grid; place-items: center; border: 1px solid #e4e4e7; background: #f8fafc; color: #71717a; text-align: center; }
.ad-slot span { font-size: 1rem; letter-spacing: .15em; }
.ad-slot--leaderboard { min-height: 5.5rem; }
.ad-slot--rectangle { min-height: 15.5rem; margin-top: 2rem; }
.ad-slot--inline { min-height: 5.25rem; margin: .5rem 0; }
.latest-section { margin-top: 2rem; }
.public-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--color-border); padding-bottom: .85rem; }
.public-section-heading h2 { margin: 0; font-size: 1.4rem; }
.public-section-heading p { margin: .4rem 0 0; color: var(--color-muted); font-size: .875rem; }
.public-section-heading > a { color: var(--color-primary); font-size: .875rem; font-weight: 700; }
.latest-problems { border-bottom: 1px solid var(--color-border); }
.latest-problem-row { display: grid; grid-template-columns: minmax(12rem, 1.6fr) 7rem minmax(8rem, 1fr) auto; gap: 1.5rem; align-items: center; min-height: 4rem; border-top: 1px solid #f4f4f5; padding: .75rem 1.5rem; }
.latest-problem-row:first-child { border-top: 0; }
.latest-problem-row h3 { margin: 0; font-size: .95rem; }
.latest-problem-row strong, .latest-problem-row span { color: var(--color-muted); font-size: .875rem; }
.latest-problem-row a { color: var(--color-primary); font-size: .875rem; font-weight: 700; text-decoration: none; }
.about-band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; margin-top: 2rem; border: 1px solid #dbeafe; padding: 1.25rem 1.5rem; background: #f8fbff; }
.about-mark { display: grid; width: 3.5rem; height: 3.8rem; place-items: center; border: 2px solid var(--color-primary); color: var(--color-primary); font-family: serif; font-size: 1.5rem; font-weight: 700; clip-path: polygon(50% 0, 88% 16%, 100% 100%, 0 100%, 12% 16%); }
.about-band h2 { margin: 0; font-size: 1.15rem; }
.about-band p { margin: .45rem 0 0; color: var(--color-muted); font-size: .875rem; line-height: 1.7; }
.about-band .secondary-button { border-color: var(--color-primary); color: var(--color-primary); }
.public-footer { border-top: 1px solid #e4e4e7; }
.public-footer__inner { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; }
.public-footer nav { display: flex; flex-wrap: wrap; gap: .65rem 2rem; padding-block: .75rem; }
.public-footer a { color: var(--color-primary); font-size: .875rem; font-weight: 700; }
.public-footer small { color: var(--color-muted); }

.public-info-page { width: min(100% - 2rem, 56rem); min-height: calc(100vh - 8rem); margin-inline: auto; padding: 3rem 0 5rem; }
.public-info-heading { border-bottom: 1px solid var(--color-border); padding-bottom: 1.5rem; }
.public-info-heading h1 { margin: 0; font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.035em; }
.public-info-heading p { margin: .8rem 0 0; color: var(--color-muted); font-size: 1.05rem; line-height: 1.8; }
.public-info-page section { padding: 2rem 0; border-bottom: 1px solid var(--color-border); }
.public-info-page section h2 { margin: 0 0 .85rem; color: #e7ba73; font-size: 1.25rem; letter-spacing: .025em; }
.public-info-page section p { margin: 0; color: var(--color-muted); line-height: 2; }
.public-info-page section p + p { margin-top: .85rem; }
.public-info-page section a { color: #e7ba73; font-weight: 700; text-underline-offset: .2rem; }
.public-info-page ul { margin: .75rem 0 0; padding-left: 1.5rem; color: var(--color-muted); line-height: 2; }
.rules-key-points { display: grid; gap: .75rem; padding: 0 !important; list-style: none; }
.rules-key-points li { display: grid; grid-template-columns: minmax(9rem, .65fr) minmax(0, 1.8fr); gap: 1rem; border: 1px solid var(--color-border); padding: 1rem 1.15rem; line-height: 1.75; }
.rules-key-points strong { color: var(--color-text); }
.rules-key-points span { color: var(--color-muted); }
.rules-section-intro { margin-bottom: 1rem !important; }
.rule-piece-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.rule-piece-grid div { border: 1px solid var(--color-border); padding: 1rem 1.15rem; }
.rule-piece-grid dt { color: #e7ba73; font-weight: 700; }
.rule-piece-grid dd { margin: .45rem 0 0; color: var(--color-muted); line-height: 1.75; }
.rules-app-note { margin-top: 2rem; border: 1px solid #6f5038; padding: 1.5rem; background: #17120f; }
.rules-app-note h2 { margin: 0; color: #e7ba73; font-size: 1.15rem; }
.rules-app-note p { margin: .75rem 0 0; color: var(--color-muted); line-height: 1.9; }
.rules-reference a + a { margin-left: .2rem; }
.public-info-updated { margin: 2rem 0 0; color: var(--color-muted); font-size: .875rem; text-align: right; }
.public-info-steps { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.public-info-steps li { display: grid; grid-template-columns: 2.4rem 9rem minmax(0, 1fr); gap: 1rem; align-items: start; color: var(--color-muted); counter-increment: step; }
.public-info-steps li::before { display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border: 1px solid #a80d19; background: #211613; color: #f3c77f; font-weight: 700; content: counter(step); }
.public-info-steps strong { padding-top: .35rem; color: var(--color-text); }
.public-info-steps span { padding-top: .25rem; line-height: 1.8; }
.public-info-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-top: 2rem; }
.public-info-actions .primary-button, .public-info-actions .secondary-button { width: 100%; margin: 0; }
.contact-destination { margin-top: 1.5rem; border: 1px solid #6f5038 !important; padding: 1.5rem !important; background: #17120f; }
.contact-email { overflow-wrap: anywhere; font-size: 1.15rem; }
.contact-destination--pending { border-style: dashed !important; }
.contact-form-section { border-bottom: 0 !important; }
.contact-form-intro { margin-bottom: 1.5rem !important; }
.contact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; border: 1px solid #6f5038; padding: 1.5rem; background: #17120f; }
.contact-form__wide { grid-column: 1 / -1; }
.contact-form__consent { display: flex; align-items: start; gap: .65rem; color: var(--color-muted); font-size: .875rem; line-height: 1.7; }
.contact-form__consent input { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .25rem; accent-color: #c51625; }
.contact-form__note { margin: -.25rem 0 0 !important; font-size: .8rem; }
.contact-form__submit { min-height: 3.25rem; margin-top: 0; }

.problem-browser { min-height: calc(100vh - 8rem); padding-block: 2.5rem 4rem; }
.problem-browser__heading h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -.035em; }
.problem-browser__heading p { margin: .75rem 0 0; color: var(--color-muted); line-height: 1.7; }
.difficulty-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 61.5rem; margin-top: 2rem; border-bottom: 1px solid var(--color-border); }
.difficulty-tabs a { position: relative; display: grid; min-height: 3.75rem; place-items: center; color: var(--color-text); font-weight: 700; text-decoration: none; }
.difficulty-tabs a:hover { color: var(--color-primary); }
.difficulty-tabs a.is-active { color: var(--color-primary); }
.difficulty-tabs a.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--color-primary); content: ""; }
.problem-browser > .notice { margin-top: 1.5rem; }
.problem-browser__layout { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(20rem, .9fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; margin-top: 1.5rem; }
.problem-results__heading { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--color-border); padding: 0 .75rem 1rem; }
.problem-results__heading h2 { margin: 0; font-size: 1.35rem; }
.problem-results__heading p { margin: 0; color: var(--color-muted); }
.progress-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .75rem 0 0; border-bottom: 1px solid var(--color-border); padding: .25rem .75rem 1rem; }
.progress-toolbar div { display: grid; gap: .25rem; }
.progress-toolbar strong { font-size: .875rem; }
.progress-toolbar small { color: var(--color-muted); line-height: 1.5; }
.browse-problem-list { min-height: 10rem; }
.browse-problem-row { display: grid; grid-template-columns: 6.5rem minmax(10rem, 1.2fr) 5rem minmax(12rem, 1fr) auto; gap: 1rem; align-items: center; min-height: 4.7rem; border-bottom: 1px solid var(--color-border); padding: .75rem; }
.browse-problem-row__number { color: var(--color-muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.browse-problem-row h3 { margin: 0; font-size: 1rem; }
.browse-problem-row__title { display: flex; flex-wrap: wrap; gap: .4rem .55rem; align-items: center; min-width: 0; }
.browse-problem-row__title h3 { min-width: 0; }
.browse-problem-row__progress { flex-basis: 100%; color: var(--color-muted); font-size: .75rem; line-height: 1.45; }
.progress-badge { display: inline-flex; align-items: center; min-height: 1.55rem; border-radius: 999px; padding: .2rem .55rem; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.progress-badge--unattempted { background: #e4e4e7; color: #3f3f46; }
.progress-badge--attempted { background: #fef3c7; color: #92400e; }
.progress-badge--solved { background: #dcfce7; color: #166534; }
.move-count-label { width: fit-content; border-radius: .2rem; padding: .35rem .55rem; background: #fde68a; font-size: .875rem; white-space: nowrap; }
.browse-problem-row p { margin: 0; color: var(--color-muted); font-size: .8rem; line-height: 1.55; }
.browse-problem-row p span { display: inline-block; margin-right: .65rem; }
.browse-problem-row__action { min-height: 2.5rem; border-color: var(--color-primary); color: var(--color-primary); font-size: .875rem; white-space: nowrap; }
.search-sidebar { position: sticky; top: 1rem; }
.detail-search { display: grid; gap: 1rem; border: 1px solid var(--color-border); padding: 1.5rem; }
.detail-search h2 { margin: 0; font-size: 1.25rem; }
.detail-search .primary-button { width: 100%; margin: .25rem 0 0; }
.detail-search__reset { justify-self: center; color: var(--color-primary); font-size: .875rem; font-weight: 700; }
.problem-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; margin-top: 1.5rem; }
.problem-pagination a { display: grid; min-width: 2.75rem; height: 2.75rem; place-items: center; border: 1px solid var(--color-border); border-radius: .25rem; padding-inline: .75rem; color: var(--color-text); text-decoration: none; }
.problem-pagination a:hover, .problem-pagination a.is-active { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }

@media (min-width: 761px) and (max-width: 1350px) {
    .home-hero__copy h1 span { display: block; white-space: nowrap; }
}

@media (min-width: 761px) and (max-width: 1180px) {
    .problem-browser__layout { grid-template-columns: minmax(0, 1fr) minmax(17rem, 18.5rem); gap: 1.5rem; }
    .browse-problem-row { grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: .55rem .75rem; padding: 1rem .5rem; }
    .browse-problem-row__title { grid-column: 2 / -1; }
    .move-count-label { grid-column: 1; grid-row: 2; }
    .browse-problem-row p { grid-column: 2 / -1; }
    .browse-problem-row__action { grid-column: 1 / -1; width: 100%; margin-top: .35rem; }
    .detail-search { padding: 1.25rem; }
    .admin-problem-row { grid-template-columns: 1fr; gap: 1rem; }
    .admin-problem-row__actions { justify-content: flex-start; }
    .editor-workspace { grid-template-columns: minmax(0, 1fr); }
    .editor-details-panel, .editor-solution-panel { border-top: 1px solid var(--color-border); border-left: 0; }
    .editor-solution-panel { grid-column: auto; }
    .editor-board-and-hands { grid-template-columns: minmax(22rem, 1fr) minmax(10.5rem, 12rem); }
}

@media (max-width: 760px) {
    .admin-list-controls { grid-template-columns: 1fr; }
    .admin-list-controls__reset { justify-self: start; }
    .home-main { padding-top: 2.5rem; }
    .problem-index { margin-top: 3rem; }
    .search-form { grid-template-columns: 1fr; }
    .search-form__reset { grid-column: auto; }
    .problem-row { grid-template-columns: 1fr; gap: .75rem; }
    .problem-row .secondary-button { width: 100%; }
    .game-main { padding-top: 2rem; }
    .problem-heading { display: grid; }
    .problem-heading .secondary-button { width: 100%; }
    .game-layout { grid-template-columns: 1fr; gap: 2rem; }
    .game-panel { border-top: 1px solid #e4e4e7; border-left: 0; padding-top: 2rem; padding-left: 0; }
    .problem-navigation { grid-template-columns: 1fr; }
    .admin-form__grid { grid-template-columns: 1fr; }
    .admin-form__wide { grid-column: auto; }
    .admin-problem-row { grid-template-columns: 1fr; gap: 1rem; }
    .admin-problem-row__actions { justify-content: flex-start; }
    .section-heading--actions { display: grid; align-items: start; }
    .section-heading--actions .primary-button { width: 100%; }
    .editor-page { padding-top: 1.5rem; }
    .editor-workspace { grid-template-columns: 1fr; }
    .editor-details-panel, .editor-solution-panel { border-top: 1px solid var(--color-border); border-left: 0; }
    .piece-palette { grid-template-columns: repeat(4, 1fr); }
    .editor-board-and-hands { grid-template-columns: 1fr; }
    .hand-editor { border-top: 1px solid #e4e4e7; border-left: 0; padding-top: 1rem; padding-left: 0; }
    .editor-board-cell { font-size: clamp(1rem, 6vw, 1.75rem); }
    .hand-editor__group { grid-template-columns: 1fr; }
    .hand-editor__rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-submit-bar { display: grid; }
    .editor-submit-bar .primary-button, .editor-submit-bar .secondary-button { width: 100%; min-width: 0; }
    .preview-dialog__body { grid-template-columns: 1fr; }
    .public-container, .site-header__inner--public { width: min(100% - 2rem, 92rem); }
    .site-header__inner--public { display: grid; min-height: 4.5rem; padding-top: .75rem; }
    .public-nav { width: 100%; gap: 0; }
    .public-nav .nav-link { flex: 1; justify-content: center; min-height: 3.25rem; padding-inline: .25rem; font-size: .8rem; white-space: nowrap; }
    .home-hero { grid-template-columns: 1fr; width: min(100% - 2rem, 40rem); gap: 2.5rem; padding: 2.75rem 0; }
    .home-hero__copy h1 { font-size: clamp(2.15rem, 10vw, 2.8rem); }
    .home-hero__copy h1 span { display: block; white-space: nowrap; }
    .home-hero__copy p br { display: none; }
    .home-board-frame { justify-self: center; }
    .difficulty-band__inner { grid-template-columns: 1fr; padding-block: 1.5rem; }
    .difficulty-links { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1rem; }
    .difficulty-links a { border-top: 1px solid #e4e4e7; border-left: 0; padding: .8rem; }
    .difficulty-links a:nth-child(even) { border-left: 1px solid #e4e4e7; }
    .public-section-heading { display: grid; align-items: start; }
    .latest-problem-row { grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; padding: 1rem 0; }
    .latest-problem-row span { grid-column: 1; }
    .latest-problem-row a { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
    .about-band { grid-template-columns: auto 1fr; }
    .about-band .secondary-button { grid-column: 1 / -1; width: 100%; }
    .public-footer__inner { display: grid; justify-content: center; gap: .75rem; padding-block: 1rem; text-align: center; }
    .problem-browser { padding-top: 2rem; }
    .difficulty-tabs { grid-template-columns: repeat(3, 1fr); }
    .difficulty-tabs a { border-bottom: 1px solid #e4e4e7; }
    .problem-browser__layout { grid-template-columns: 1fr; }
    .search-sidebar { position: static; }
    .browse-problem-row { grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: .55rem .75rem; padding: 1rem 0; }
    .browse-problem-row__title { grid-column: 2 / -1; }
    .move-count-label { grid-column: 1; grid-row: 2; }
    .browse-problem-row p { grid-column: 2 / -1; }
    .browse-problem-row__action { grid-column: 1 / -1; width: 100%; margin-top: .35rem; }
    .progress-toolbar { display: grid; align-items: start; padding-inline: 0; }
    .progress-toolbar .secondary-button { width: 100%; }
    .ad-slot--rectangle { min-height: 8rem; }
}

@media (min-width: 1181px) and (max-width: 1350px) {
    .editor-workspace { grid-template-columns: minmax(29rem, 1.2fr) minmax(19rem, .8fr); }
    .editor-solution-panel { grid-column: 1 / -1; border-top: 1px solid var(--color-border); border-left: 0; }
    .solution-move-list { min-height: 6rem; }
}

/* Crimson public home */
.crimson-home-page {
    --dojo-black: #090909;
    --dojo-surface: #11100f;
    --dojo-surface-soft: #191715;
    --dojo-crimson: #a80d19;
    --dojo-crimson-dark: #69070d;
    --dojo-wood: #d59a4b;
    --dojo-wood-light: #e7ba73;
    --dojo-copper: #8f5430;
    --dojo-ink-white: #f3efe6;
    --dojo-muted: #b9b1a6;
    min-height: 100vh;
    background: var(--dojo-black);
    color: var(--dojo-ink-white);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}
.dojo-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: min(calc(100% - 3rem), 92rem);
    min-height: 4.4rem;
    margin-inline: auto;
    border-bottom: 1px solid #4a2b20;
}
.dojo-brand { display: inline-flex; align-items: center; gap: 1rem; color: var(--dojo-ink-white); text-decoration: none; }
.dojo-brand__mark { display: grid; width: 2.65rem; height: 2.65rem; place-items: center; border: 2px solid #d41423; color: #e32635; font-size: 1.45rem; line-height: 1; }
.dojo-brand strong { font-size: clamp(1.35rem, 2.4vw, 2rem); font-weight: 600; letter-spacing: .11em; }
.dojo-nav { display: flex; align-items: stretch; gap: clamp(1.25rem, 4vw, 3.5rem); }
.dojo-nav a { position: relative; display: grid; place-items: center; color: var(--dojo-ink-white); font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; font-size: .95rem; text-decoration: none; }
.dojo-nav a:hover, .dojo-nav a.is-current { color: #f02938; }
.dojo-nav a.is-current::after { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: #d41423; content: ""; }
.crimson-hero {
    display: grid;
    align-items: center;
    width: min(calc(100% - 3rem), 82rem);
    min-height: 12rem;
    margin-inline: auto;
    padding-block: 1.5rem;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.crimson-hero__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 68rem); gap: 1.25rem; margin-inline: auto; }
.crimson-action { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 5.5rem; border: 1px solid; border-radius: .2rem; padding: 1.1rem 1.8rem 1.2rem 2.4rem; font-size: 1.5rem; font-weight: 700; letter-spacing: .08em; text-decoration: none; transition: border-color .18s ease, filter .18s ease, transform .18s ease; }
.crimson-action svg { width: 1.55rem; height: 1.55rem; fill: none; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; stroke-width: 2; }
.crimson-action--primary { border-color: #df2533; background: var(--dojo-crimson); color: #fff7ed; }
.crimson-action--wood { border-color: var(--dojo-wood); background: #d7a15c; color: #160f08; }
.crimson-action:hover { filter: brightness(1.08); transform: translateX(3px); }
.crimson-utility { width: min(calc(100% - 3rem), 92rem); margin-inline: auto; padding: 1.15rem 0 1rem; }
.crimson-announcement { display: flex; align-items: center; min-height: 3.5rem; margin: 0; background: var(--dojo-surface-soft); color: var(--dojo-ink-white); font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; }
.crimson-announcement strong { align-self: stretch; display: grid; place-items: center; padding: .5rem 1rem; background: #8f1019; font-weight: 500; }
.crimson-announcement span { padding: .75rem 1.3rem; }
.crimson-ad { display: grid; min-height: 4.25rem; place-items: center; margin-top: .75rem; border: 1px dashed #665d55; color: #8f8780; font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; }
.crimson-ad span { letter-spacing: .25em; }
.home-latest { width: min(calc(100% - 3rem), 72rem); margin: 1rem auto 2rem; font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; }
.home-latest__heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-bottom: .7rem; border-bottom: 1px solid #4a2b20; }
.home-latest__heading p { margin: 0 0 .25rem; color: #d59a4b; font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.home-latest__heading h2 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 1.4rem; font-weight: 600; letter-spacing: .08em; }
.home-latest__heading > a { color: #e7ba73; font-size: .85rem; font-weight: 700; text-underline-offset: .25rem; }
.home-latest__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .75rem; padding-top: .75rem; }
.home-latest-card { display: grid; grid-template-rows: auto auto 1fr; min-width: 0; min-height: 8.5rem; border: 1px solid #493b32; background: #11100f; padding: .9rem; }
.home-latest-card__heading { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.home-latest-card h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 1.05rem; font-weight: 600; line-height: 1.5; }
.home-latest-card__heading strong { flex: none; padding: .25rem .45rem; background: #d59a4b; color: #160f08; font-size: .75rem; }
.home-latest-card__status { width: fit-content; margin-top: .75rem; border-radius: 999px; padding: .2rem .55rem; font-size: .7rem; font-weight: 700; }
.home-latest-card__status.is-unattempted { background: #2a2724; color: #c8c0b7; }
.home-latest-card__status.is-attempted { background: #4a3014; color: #f3c77f; }
.home-latest-card__status.is-solved { background: #173821; color: #9fe1af; }
.home-latest-card__action { align-self: end; width: fit-content; margin-top: .75rem; color: #e7ba73; font-size: .8rem; font-weight: 700; text-underline-offset: .25rem; }
.home-latest__status { grid-column: 1 / -1; margin: 0; padding: 1.25rem; border: 1px solid #493b32; color: #b9b1a6; }
.home-rules-guide { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; width: min(calc(100% - 3rem), 72rem); margin: 0 auto 2rem; border: 1px solid #6f5038; padding: 1rem 1.25rem; background: #17120f; font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; }
.home-rules-guide p { margin: 0 0 .3rem; color: #d59a4b; font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.home-rules-guide h2 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 1.1rem; letter-spacing: .04em; }
.home-rules-guide span { display: block; margin-top: .3rem; color: #b9b1a6; font-size: .8rem; line-height: 1.55; }
.home-rules-guide > a { min-width: 11rem; border: 1px solid #d59a4b; padding: .65rem .85rem; color: #e7ba73; font-size: .8rem; font-weight: 700; text-align: center; text-decoration: none; }
.home-rules-guide > a:hover { background: #241d18; }
.crimson-footer { display: grid; gap: .75rem; place-items: center; border-top: 1px solid #4a2b20; padding: 1rem; color: #d5cec4; font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; }
.crimson-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem 1.4rem; }
.crimson-footer a { color: inherit; font-size: .8rem; text-decoration: none; }
.crimson-footer a + a { border-left: 1px solid #82786e; padding-left: 1.4rem; }
.crimson-footer small { font-size: .72rem; }

@media (max-width: 760px) {
    .dojo-header { display: grid; width: min(calc(100% - 1.25rem), 40rem); min-height: 0; padding-top: .85rem; }
    .dojo-brand { justify-content: center; }
    .dojo-brand__mark { width: 2.25rem; height: 2.25rem; font-size: 1.2rem; }
    .dojo-brand strong { font-size: 1.35rem; }
    .dojo-nav { width: 100%; gap: 0; margin-top: .65rem; }
    .dojo-nav a { flex: 1; min-height: 2.8rem; padding-inline: .35rem; font-size: .72rem; white-space: nowrap; }
    .crimson-hero { width: min(calc(100% - 2rem), 40rem); min-height: 0; padding-block: 1.5rem; }
    .crimson-hero__actions { grid-template-columns: 1fr; gap: .75rem; }
    .crimson-action { min-height: 4.8rem; padding: .9rem 1.15rem 1rem 1.4rem; font-size: 1.15rem; }
    .crimson-utility { width: min(calc(100% - 1.25rem), 40rem); }
    .crimson-announcement { align-items: stretch; font-size: .8rem; }
    .crimson-announcement strong { padding-inline: .65rem; }
    .crimson-announcement span { display: grid; align-items: center; padding-inline: .8rem; }
    .home-latest { width: min(calc(100% - 2rem), 40rem); margin-block: .75rem 1.5rem; }
    .home-latest__heading { align-items: center; }
    .home-latest__heading h2 { font-size: 1.2rem; }
    .home-latest__list { grid-template-columns: 1fr; gap: .5rem; }
    .home-latest-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; min-height: 0; padding: .8rem .9rem; }
    .home-latest-card__heading { grid-column: 1 / -1; }
    .home-latest-card__status { grid-row: 2; grid-column: 1; margin-top: .55rem; }
    .home-latest-card__action { grid-row: 2; grid-column: 2; margin-top: .55rem; }
    .home-rules-guide { grid-template-columns: 1fr auto; width: min(calc(100% - 2rem), 40rem); gap: .75rem; margin-bottom: 1.5rem; padding: .9rem 1rem; }
    .home-rules-guide h2 { font-size: 1rem; line-height: 1.45; }
    .home-rules-guide span { display: none; }
    .home-rules-guide > a { width: 100%; min-width: 9rem; padding: .65rem; }
    .crimson-footer nav { gap: .75rem; }
    .crimson-footer a + a { padding-left: .75rem; }
    .public-info-page { padding-block: 2rem 3.5rem; }
    .public-info-heading p { font-size: .95rem; }
    .public-info-page section { padding-block: 1.5rem; }
    .public-info-steps li { grid-template-columns: 2.4rem minmax(0, 1fr); gap: .35rem .8rem; }
    .public-info-steps strong { align-self: center; padding: 0; }
    .public-info-steps span { grid-column: 2; padding: 0; }
    .public-info-actions { grid-template-columns: 1fr; }
    .contact-form { grid-template-columns: 1fr; padding: 1.1rem; }
    .contact-form__wide { grid-column: auto; }
    .rules-key-points li { grid-template-columns: 1fr; gap: .25rem; }
    .rule-piece-grid { grid-template-columns: 1fr; }
    .rules-app-note { padding: 1.25rem; }
}

@media (min-width: 761px) {
    .crimson-hero { min-height: clamp(13.5rem, 16.67vw, 15rem); }
    .crimson-action { min-height: clamp(7rem, 8.9vw, 8rem); padding-block: 1.5rem; font-size: clamp(1.65rem, 1.7vw, 1.75rem); }
}

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

/* Shared crimson, ink and wood theme */
body:not(.crimson-home-page) {
    --color-bg: #090909;
    --color-text: #f3efe6;
    --color-muted: #b9b1a6;
    --color-border: #493b32;
    --color-primary: #c51625;
    --color-primary-hover: #e02434;
    --color-board-hover: rgb(231 186 115 / .28);
    --color-board-selected: rgb(197 22 37 / .52);
    --color-board-legal: rgb(255 230 146 / .38);
    --color-success: #86d99b;
    --color-danger: #ff7b7b;
    background: #090909;
    color: var(--color-text);
}
body:not(.crimson-home-page) h1,
body:not(.crimson-home-page) h2,
body:not(.crimson-home-page) h3,
body:not(.crimson-home-page) .brand {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}
body:not(.crimson-home-page) .site-header { border-color: #4a2b20; background: #11100f; }
body:not(.crimson-home-page) .brand { color: #f3efe6; letter-spacing: .08em; }
body:not(.crimson-home-page) .nav-link { border-radius: 0; color: #d5cec4; }
body:not(.crimson-home-page) .nav-link:hover,
body:not(.crimson-home-page) .nav-link.is-current { background: transparent; color: #f02938; }
body:not(.crimson-home-page) .public-nav .nav-link.is-current::after { background: #d41423; }
body:not(.crimson-home-page) .primary-button { border-color: #df2533; background: #a80d19; color: #fff7ed; }
body:not(.crimson-home-page) .primary-button:hover { background: #c51625; }
body:not(.crimson-home-page) .secondary-button { border-color: #7b5d48; background: #171513; color: #e7ba73; }
body:not(.crimson-home-page) .secondary-button:hover { border-color: #d59a4b; background: #241d18; }
body:not(.crimson-home-page) .problem-heading,
body:not(.crimson-home-page) .problem-details,
body:not(.crimson-home-page) .problem-details div,
body:not(.crimson-home-page) .problem-navigation,
body:not(.crimson-home-page) .admin-heading,
body:not(.crimson-home-page) .admin-section,
body:not(.crimson-home-page) .admin-problem-list,
body:not(.crimson-home-page) .admin-problem-row,
body:not(.crimson-home-page) .problem-results__heading,
body:not(.crimson-home-page) .browse-problem-row,
body:not(.crimson-home-page) .difficulty-tabs,
body:not(.crimson-home-page) .difficulty-tabs a,
body:not(.crimson-home-page) .public-footer { border-color: #493b32; }
body:not(.crimson-home-page) .game-panel,
body:not(.crimson-home-page) .hand-editor,
body:not(.crimson-home-page) .editor-details-panel,
body:not(.crimson-home-page) .editor-solution-panel { border-color: #493b32; }
body:not(.crimson-home-page) .completion-actions { border-color: #6f5038; background: #1b1612; }
body:not(.crimson-home-page) .completion-actions p,
body:not(.crimson-home-page) .hint-dialog__note { color: #b8ada2; }
body:not(.crimson-home-page) .hand-piece.is-hint-source { border-color: #e7ba73; box-shadow: 0 0 0 3px rgb(231 186 115 / .28); }
body:not(.crimson-home-page) .form-field { color: #e9e3da; }
body:not(.crimson-home-page) .form-field input,
body:not(.crimson-home-page) .form-field select,
body:not(.crimson-home-page) .form-field textarea {
    border-color: #57483d;
    background: #161412;
    color: #f3efe6;
}
body:not(.crimson-home-page) .form-field input::placeholder,
body:not(.crimson-home-page) .form-field textarea::placeholder { color: #80776f; }
body:not(.crimson-home-page) .detail-search,
body:not(.crimson-home-page) .editor-workspace,
body:not(.crimson-home-page) .editor-json-details,
body:not(.crimson-home-page) .hint-dialog,
body:not(.crimson-home-page) .promotion-choice-dialog,
body:not(.crimson-home-page) .editor-preview-dialog,
body:not(.crimson-home-page) .admin-auth__form {
    border: 1px solid #493b32;
    background: #11100f;
    color: #f3efe6;
}
body:not(.crimson-home-page) .admin-auth__form { padding: 2rem; }
body:not(.crimson-home-page) .editor-submit-bar { border-color: #493b32; background: rgb(9 9 9 / .96); }
body:not(.crimson-home-page) .piece-owner-toggle button,
body:not(.crimson-home-page) .editor-board-tools button,
body:not(.crimson-home-page) .hand-counter button,
body:not(.crimson-home-page) .preview-dialog__heading button {
    border-color: #57483d;
    background: #1a1715;
    color: #e9e3da;
}
body:not(.crimson-home-page) .piece-owner-toggle button.is-active,
body:not(.crimson-home-page) .editor-board-tools button:hover,
body:not(.crimson-home-page) .editor-board-tools button.is-active {
    border-color: #d59a4b;
    background: #8f1019;
    color: #fff7ed;
}
body:not(.crimson-home-page) .piece-palette button { border-color: #8f5430; background: #211913; }
body:not(.crimson-home-page) .piece-palette button small { color: #d9aa69; }
body:not(.crimson-home-page) .hand-counter,
body:not(.crimson-home-page) .solution-move-list,
body:not(.crimson-home-page) .solution-move-list li { border-color: #493b32; }
body:not(.crimson-home-page) .move-count-label { background: #d59a4b; color: #160f08; }
body:not(.crimson-home-page) .progress-badge--unattempted { background: #2a2724; color: #c8c0b7; }
body:not(.crimson-home-page) .progress-badge--attempted { background: #4a3014; color: #f3c77f; }
body:not(.crimson-home-page) .progress-badge--solved { background: #173821; color: #9fe1af; }
body:not(.crimson-home-page) .difficulty-tabs a:hover,
body:not(.crimson-home-page) .difficulty-tabs a.is-active,
body:not(.crimson-home-page) .detail-search__reset,
body:not(.crimson-home-page) .public-footer a { color: #e7ba73; }
body:not(.crimson-home-page) .difficulty-tabs a.is-active::after { background: #c51625; }
body:not(.crimson-home-page) .problem-pagination a { border-color: #57483d; color: #e7ba73; }
body:not(.crimson-home-page) .problem-pagination a:hover,
body:not(.crimson-home-page) .problem-pagination a.is-active { border-color: #c51625; background: #a80d19; color: #fff7ed; }
body:not(.crimson-home-page) .ad-slot { border-color: #665d55; background: #11100f; color: #8f8780; }
body:not(.crimson-home-page) .public-footer { background: #11100f; }
body:not(.crimson-home-page) .preview-banner { border-color: #d59a4b; background: #241d18; color: #f5d39e; }
body:not(.crimson-home-page) .notice { background: #171513; }
body:not(.crimson-home-page) .notice--error { border-color: #8f2828; background: #2a1111; }
body:not(.crimson-home-page) .notice--success { border-color: #326b43; background: #102217; }
body:not(.crimson-home-page) .danger-button { border-color: #8f2828; background: #171513; color: #ff8b8b; }
body:not(.crimson-home-page) .danger-button:hover { background: #2a1111; }
body:not(.crimson-home-page) .status-badge--published { background: #173821; color: #9fe1af; }
body:not(.crimson-home-page) .status-badge--draft { background: #2a2724; color: #c8c0b7; }
body:not(.crimson-home-page) :focus-visible { outline-color: #e7ba73; }

/* User-provided shogi board and piece artwork */
.shogi-board,
.editor-shogi-board {
    position: relative;
    aspect-ratio: 458 / 500;
    border: 0;
    padding: 1.2% 1.31%;
    background: #d59a4b url("../images/shogi/board.png") center / 100% 100% no-repeat;
    box-shadow: 0 .75rem 1.8rem rgb(0 0 0 / .38);
}
.board-column { width: min(100%, 32rem); justify-self: center; }
.board-cell,
.editor-board-cell {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    place-items: center;
    overflow: hidden;
    border: 0;
    background: transparent;
}
.board-cell::after,
.editor-board-cell::after {
    position: absolute;
    z-index: 0;
    inset: 2px;
    pointer-events: none;
    content: "";
}
.board-cell:hover::after,
.editor-board-cell:hover::after { background: var(--color-board-hover); }
.board-cell.is-legal::after { background: var(--color-board-legal); }
.board-cell.is-selected::after,
.editor-board-cell.is-selected::after { background: var(--color-board-selected); }
.piece-sprite {
    position: relative;
    z-index: 1;
    display: block;
    width: 94%;
    max-height: 94%;
    aspect-ratio: 69.75 / 72.75;
    background: url("../images/shogi/pieces.png") var(--piece-x, 0%) var(--piece-y, 0%) / 800% 400% no-repeat;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / .34));
}
.piece-sprite--palette { width: 2.5rem; }
.hand-pieces { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.hand-piece { position: relative; display: grid; width: 2.25rem; place-items: center; }
.hand-piece { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }
.hand-piece:hover:not(:disabled), .hand-piece.is-selected { outline: 2px solid #e7ba73; outline-offset: 2px; }
.hand-piece.is-hint-source { outline: 3px solid #a80d19; outline-offset: 3px; }
.hand-piece:disabled { cursor: default; opacity: .72; }
.hand-piece .piece-sprite { width: 100%; }
.hand-piece strong { position: absolute; right: -.2rem; bottom: -.15rem; z-index: 2; display: grid; min-width: 1.15rem; height: 1.15rem; place-items: center; border-radius: 50%; background: #a80d19; color: #fff; font-size: .72rem; }
.hand-counter__piece.is-selected { background: #8f1019 !important; color: #fff7ed !important; }
.hand-counter__piece:disabled { cursor: default; opacity: .55; }
.hand-editor.is-recording .hand-counter__piece:not(:disabled) { background: #d59a4b !important; color: #160f08 !important; font-weight: 700; }
.hand-editor.is-recording .hand-counter__piece.is-selected { background: #a80d19 !important; color: #fff7ed !important; }

@media (max-width: 760px) {
    body:not(.crimson-home-page) .admin-auth__form { padding: 1.5rem; }
    .piece-sprite--palette { width: 2.25rem; }
}
