.solver-page { padding-bottom: 68px; }
.solver-heading { padding: clamp(22px, 4vw, 42px); border-radius: 14px 14px 0 0; color: #f7f5fd; background: #24203f; }
.solver-heading h1 { font-size: clamp(1.9rem, 5vw, 4.3rem); font-weight: 850; line-height: 1.16; letter-spacing: -.058em; }
.solver-heading p { margin-top: 11px; color: #ebe7f8; max-width: 55em; }
.solver-linebreak { display: none; }
.solver-tool { background: white; border: 1px solid var(--stroke); border-top: 0; border-radius: 0 0 14px 14px; }
.tool-heading { min-height: 67px; padding: 13px clamp(14px, 3vw, 30px);
  display: flex; justify-content: space-between; gap: 11px; align-items: center; }
.tool-heading h2 { font-size: clamp(1.01rem, 2.25vw, 1.36rem); display: flex; align-items: center; gap: 9px; }
.tool-heading h2 svg { color: #7256cd; }
.tool-tabs { display: flex; gap: 4px; padding-inline: clamp(12px, 3vw, 29px); background: #f3f1f9; border-block: 1px solid #e5e0ef; }
.tool-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0;
  border-radius: 0; border-bottom: 3px solid transparent; padding: 9px 12px 6px; min-height: 45px;
  color: #554d69; background: transparent; font-weight: 720; }
.tool-tabs button[aria-selected="true"] { border-color: #795ad8; color: #46328e; background: #e9e2f9; }
.solver-workspace { display: grid; grid-template-columns: minmax(270px, 1fr) minmax(0, 1.05fr); gap: clamp(15px, 4vw, 50px);
  padding: clamp(13px, 3vw, 32px); align-items: start; }
.input-panel { min-width: 0; }
.input-title { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-bottom: 9px; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.edit-actions button { display: flex; align-items: center; gap: 4px; min-height: 34px; padding: 4px 7px;
  border: 1px solid #e2dceb; border-radius: 5px; color: #4e3b7f; background: #faf8ff; font-size: .75rem; font-weight: 650; }
.edit-actions button:disabled { color: #777085; background: #f8f7fa; }
.redo-icon { transform: scaleX(-1); display: inline-flex; }
.labeled-board { display: grid; grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: 18px minmax(0, 1fr); gap: 4px;
  width: min(100%, 366px); margin-inline: auto; }
.column-labels, .row-labels { display: grid; justify-items: center; align-items: center; color: #5c506f; font-size: .73rem; font-weight: 710; }
.column-labels { grid-column: 2; grid-row: 1; grid-template-columns: repeat(8, 1fr); }
.row-labels { grid-column: 1; grid-row: 2; grid-template-rows: repeat(8, 1fr); }
.manual-grid, .image-grid, .custom-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.manual-grid { grid-column: 2; grid-row: 2; aspect-ratio: 1; touch-action: none; user-select: none; }
.edit-cell { min-width: 0; min-height: 0; padding: 0; background: #f1eff6; border: 1px solid #d5d0e3; border-radius: 4px; }
.edit-cell:hover { border-color: #8c70d6; }
.edit-cell[aria-pressed="true"] { border-color: #694cb4; background: #a78aee; box-shadow: inset 0 3px #bdabf3; }
.edit-cell:focus-visible { z-index: 1; outline-offset: 0; }
.editor-hint { color: var(--muted); font-size: .84rem; margin-top: 9px; }
.solver-controls { min-width: 0; }
.solver-controls h3 { margin-bottom: 9px; }
.solver-tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.solver-slot { display: grid; place-items: center; align-content: start; gap: 2px; min-height: 115px; min-width: 0;
  color: #493767; background: #f8f5fc; border: 1px dashed #b9a7da; border-radius: 8px; padding: 7px 4px;
  font-size: .73rem; font-weight: 690; text-align: center; }
.solver-slot:hover { border-color: #8062c5; background: #f0e9fa; }
.solver-slot > span:last-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.slot-glyph { min-height: 50px; display: grid; place-items: center; }
.slot-glyph .shape-glyph { --tile-unit: 8px; --tile-gap: 2px; }
.blank-piece { color: #6f4ea8; font-size: 1.55rem; font-weight: 450; }
.solver-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(75px, 110px); gap: 9px; margin-block: 17px 12px; }
.field { display: grid; gap: 5px; color: #43375c; font-size: .82rem; font-weight: 720; }
.field select, .field input { min-width: 0; min-height: 41px; width: 100%; padding: 5px 8px;
  border: 1px solid #cfc6df; border-radius: 6px; background: #fbfaff; color: #352649; }
.solve-button { gap: 6px; width: 100%; }
.solve-status { margin-top: 10px; min-height: 1.45em; color: #4b357f; font-size: .86rem; font-weight: 720; }
.privacy-note { margin-top: 9px; display: flex; align-items: flex-start; gap: 7px; color: var(--muted); font-size: .8rem; }
.privacy-note svg { margin-top: 1px; color: #635386; }
.upload-zone { display: grid; justify-items: center; align-content: center; gap: 8px;
  border: 1px dashed #a995ce; border-radius: 9px; background: #f8f5fd; color: #564171; padding: 15px; min-height: 161px; text-align: center; }
.upload-zone[data-dragging="true"] { background: #eee2fb; outline: 2px solid #a286e0; }
.upload-zone p, .upload-zone > span { color: #655672; font-size: .76rem; }
.file-label { position: relative; overflow: hidden; min-height: 38px; cursor: pointer; }
.file-label:focus-within { outline: 3px solid #735de0; outline-offset: 2px; }
.file-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.review-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px; margin: 11px 0 6px; }
.image-frame { margin: 0 auto; width: fit-content; max-width: 100%; position: relative; isolation: isolate; }
.image-frame canvas { display: block; width: 100%; height: auto; }
.image-frame.is-calibrating { cursor: crosshair; }
.image-frame[data-marked]::after { content: ''; position: absolute; left: var(--mark-x); top: var(--mark-y);
  width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; background: #7147dd; transform: translate(-50%, -50%); pointer-events: none; }
.image-grid { position: absolute; grid-template-rows: repeat(8, minmax(0, 1fr)); gap: 0; outline: 2px solid #91f1cc; }
.is-calibrating .image-grid { pointer-events: none; }
.image-grid .edit-cell { border-radius: 0; background: #3fcb9521; border: 1px solid #e9fff3a6; }
.image-grid .edit-cell[aria-pressed="true"] { background: #b385f752; box-shadow: inset 0 0 0 1px #eddaff; }
.image-grid .edit-cell:hover { background: #fae78558; }
.piece-dialog { width: min(420px, calc(100% - 24px)); max-height: calc(100% - 28px); margin: auto; padding: 0;
  color: var(--ink); background: white; border: 1px solid #cabee3; border-radius: 13px; }
.piece-dialog::backdrop { background: #201935a6; }
.dialog-inner { padding: 17px; }
.dialog-inner h3 { margin-bottom: 12px; font-size: 1.25rem; }
.custom-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(100%, 228px); margin: 12px auto 8px; aspect-ratio: 1; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.solution { border-top: 1px solid #e4daee; background: #f6f2fc; padding: clamp(14px, 3vw, 32px); border-radius: 0 0 14px 14px; }
.solution-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 17px; }
.solution-header span { color: #5c4d70; font-size: .8rem; }
.plans { display: flex; gap: 6px; flex-wrap: wrap; margin: 13px 0; }
.plan-button { min-height: 41px; border: 1px solid #cbbce6; border-radius: 6px; background: white; color: #49366d;
  padding: 5px 11px; font-size: .88rem; font-weight: 730; }
.plan-button[aria-pressed="true"] { color: white; background: #6044a1; border-color: #6044a1; }
.metric-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 15px; color: #4a3d62; }
.metric-chips li { display: inline-flex; align-items: baseline; gap: 5px; background: #fff; border: 1px solid #dcd2ee;
  border-radius: 6px; padding: 5px 8px; font-size: .77rem; }
.metric-chips strong { font-size: .96rem; }
.result-grid { display: grid; grid-template-columns: minmax(180px, 278px) minmax(0, 1fr); gap: clamp(12px, 3vw, 35px); }
.result-board { width: min(100%, 278px); display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px; border-radius: 9px; aspect-ratio: 1; background: #201c36; padding: 6px; }
.result-cell { min-width: 0; border-radius: 3px; background: #393251; border: 1px solid #4d4567; }
.result-cell[data-state="filled"] { background: #a58beb; border-color: #b69bed; }
.result-cell.is-cleared { background: repeating-linear-gradient(-45deg, #4a3a6a 0 3px, #60507e 3px 6px); border-color: #aa8edb; }
.result-cell.is-placement { outline: 2px solid #9decce; outline-offset: -2px; background-color: #527f74; }
.result-legend { list-style: none; display: flex; gap: 8px 12px; flex-wrap: wrap; margin: 5px 0 0; padding: 0;
  color: #554862; font-size: .71rem; }
.result-legend li::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 4px; background: #527f74; border: 2px solid #9decce; }
.result-legend li + li::before { background: #685483; border-color: #aa8edb; }
.step-info { align-self: center; }
.step-index { color: #614b87; font-size: .79rem; font-weight: 700; }
.step-info h3 { margin-top: 3px; }
.coordinate { font-weight: 850; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.step-lines { margin: 8px 0 5px; }
.step-lines dt { color: #5e4f73; font-size: .84rem; }
.step-lines dd { margin: 0; font-weight: 700; }
.step-controls { display: flex; gap: 8px; margin-top: 11px; }
.step-controls .button { min-height: 39px; font-size: .86rem; }
.apply-button { margin-top: 17px; }
.solver-reading { width: min(925px, 100%); margin: 40px auto 0; }
.solver-reading > section { margin-bottom: 31px; }
.solver-reading h2 { margin-bottom: 9px; }
.solver-reading p, .solver-reading li { color: #4c455e; }
.solver-reading ol { padding-inline-start: 1.7em; }
.solver-reading ol li + li { margin-top: 6px; }
.worked-example { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 230px); gap: 22px;
  padding: clamp(15px, 3vw, 28px); border: 1px solid #dcdbed; border-radius: 10px; background: white; }
.worked-example a { margin-top: 10px; font-size: .88rem; }
.example-pieces { display: flex; gap: 15px; margin-top: 9px; justify-content: center; }
.solver-limits p + p { margin-top: 9px; }
@media (max-width: 730px) {
  .solver-page { padding-bottom: 38px; }
  .solver-linebreak { display: initial; }
  .solver-heading { border-radius: 11px 11px 0 0; }
  .solver-heading p { font-size: .89rem; }
  .tool-heading .button-small { min-height: 37px; gap: 5px; padding-inline: 6px; font-size: .73rem; }
  .tool-heading h2 svg { display: none; }
  .tool-tabs button { flex: 1; font-size: .82rem; padding-inline: 4px; }
  .solver-workspace { grid-template-columns: minmax(0, 1fr); }
  .solver-controls h3 { border-top: 1px solid #e9e2f3; padding-top: 13px; }
  .solver-slot { min-height: 99px; }
  .solver-settings { grid-template-columns: minmax(0, 1fr); }
  .combo-field input { max-width: 133px; }
  .result-grid, .worked-example { grid-template-columns: minmax(0, 1fr); }
  .worked-example > div:nth-child(2) { max-width: 230px; }
  .apply-button { white-space: normal; }
}
