:root {
  --ink: #192329;
  --muted: #69757a;
  --line: #dfe5e6;
  --paper: #f8faf9;
  --white: #fff;
  --mint: #eaf5ee;
  --accent: #147b56;
  --accent-dark: #0c6042;
  --shadow: 0 18px 44px rgba(25, 35, 41, .08);
  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; background: var(--paper); line-height: 1.65; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-header {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 800; letter-spacing: .04em; }
.brand-mark { width: 26px; height: 26px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(-8deg); }
.brand-mark i { display: block; border-radius: 4px; background: #fff; border: 1px solid #b8c5c8; box-shadow: inset 0 -2px 0 rgba(0,0,0,.1); }
.brand-mark i:nth-child(2) { background: #e85b53; }
.brand-mark i:nth-child(3) { background: #4a75bb; }
.brand-mark i:nth-child(4) { background: #f2cc54; }
.header-link { color: var(--muted); font-size: .9rem; text-underline-offset: 5px; }

main { overflow: hidden; }
.hero { width: min(1240px, calc(100% - 48px)); margin: 34px auto 92px; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: clamp(32px, 6vw, 90px); }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.035em; }
h1 { margin-bottom: 24px; font-size: clamp(2.6rem, 5.5vw, 5.25rem); font-weight: 850; }
h1 em { color: var(--accent); font-style: normal; }
.hero-lead { max-width: 500px; color: var(--muted); font-size: 1.07rem; }
.hero-notes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-notes span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: #506066; background: rgba(255,255,255,.7); font-size: .78rem; font-weight: 700; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.hero-actions .button { display: inline-flex; align-items: center; text-decoration: none; }
.hero-actions > span { color: var(--muted); font-size: .76rem; }
.hero-art { position: relative; min-width: 0; }
.hero-art::before { content: ""; position: absolute; width: 72%; height: 72%; right: 5%; top: 15%; border-radius: 50%; background: #e4f1e8; filter: blur(2px); }
.hero-art img { position: relative; z-index: 1; display: block; width: 100%; height: auto; border-radius: 34px 34px 34px 8px; box-shadow: var(--shadow); }
.art-caption { position: absolute; z-index: 2; left: 22px; bottom: 18px; padding: 8px 12px; border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.88); font-size: .75rem; font-weight: 800; }

.workbench, .solution, .how-to, .limits { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.workbench { padding: 62px 0 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(1.8rem, 3vw, 3rem); }
.section-note { max-width: 330px; margin: 0; color: var(--muted); font-size: .9rem; }
.workbench-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.input-desk, .control-rail, .preview-panel, .moves-panel { border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.input-desk { min-width: 0; padding: clamp(20px, 3.5vw, 40px); border-radius: var(--radius-lg) 12px var(--radius-lg) var(--radius-lg); }
.desk-heading, .preview-header, .moves-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.step-tag { display: inline-block; color: var(--accent); font-size: .69rem; font-weight: 850; letter-spacing: .13em; }
.desk-heading h3, .rail-block h3, .moves-header h3 { margin: 5px 0 0; font-size: 1.3rem; }
.desk-hint { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.orientation-note { margin: 20px 0 22px; padding: 13px 16px; border-left: 3px solid #9dcead; background: var(--mint); color: #4c6256; font-size: .83rem; }
.orientation-note strong { display: block; margin-bottom: 2px; color: var(--accent-dark); font-size: .73rem; letter-spacing: .08em; }
.orientation-note b { color: var(--ink); }
.orientation-note small, .orientation-anchors { display: block; margin-top: 5px; }
.orientation-anchors { color: var(--ink); font-weight: 750; }
.orientation-note small { color: #577065; font-size: .74rem; }
.palette { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 25px; }
.palette-label { color: var(--muted); font-size: .78rem; font-weight: 800; }
.palette-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.color-choice { min-height: 42px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; color: #506066; background: #fff; font-size: .8rem; font-weight: 750; }
.color-choice:hover { border-color: #9fb2b6; }
.color-choice.is-selected { border-color: var(--accent); color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(20,123,86,.12); }
.color-dot { display: inline-block; width: 17px; height: 17px; border: 1px solid rgba(25,35,41,.16); border-radius: 50%; }
.face-board { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 12px; max-width: 670px; margin: 0 auto; }
.face-panel { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f9fbfb; }
.face-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; color: var(--ink); font-size: .82rem; font-weight: 850; }
.face-title small { color: var(--muted); font-size: .7rem; font-weight: 650; }
.face-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.face-grid > :nth-child(1) { grid-column: 1; grid-row: 1; }
.face-grid > :nth-child(2) { grid-column: 2; grid-row: 1; }
.face-grid > :nth-child(3) { grid-column: 2; grid-row: 2; }
.face-grid > :nth-child(4) { grid-column: 1; grid-row: 2; }
.sticker { min-width: 44px; aspect-ratio: 1; padding: 0; border: 2px solid rgba(25,35,41,.13); border-radius: 7px; background: #edf1f1; box-shadow: inset 0 -3px 0 rgba(25,35,41,.1); transition: transform .15s ease, box-shadow .15s ease; }
.sticker:hover { transform: translateY(-2px); box-shadow: inset 0 -3px 0 rgba(25,35,41,.1), 0 5px 10px rgba(25,35,41,.12); }
.sticker.is-empty { background: repeating-linear-gradient(135deg, #edf1f1, #edf1f1 7px, #e2e8e8 7px, #e2e8e8 9px); }
.color-U { background: #fbfcfa; }
.color-R { background: #e85b53; }
.color-F { background: #39a96b; }
.color-D { background: #f2cc54; }
.color-L { background: #e58a4d; }
.color-B { background: #4a75bb; }
.sticker.color-U { background: #fbfcfa; }
.sticker.color-R { background: #e85b53; }
.sticker.color-F { background: #39a96b; }
.sticker.color-D { background: #f2cc54; }
.sticker.color-L { background: #e58a4d; }
.sticker.color-B { background: #4a75bb; }

.desk-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.button { min-height: 46px; padding: 10px 15px; border: 1px solid transparent; border-radius: 10px; font-size: .82rem; font-weight: 800; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { border-color: #bed0c6; color: var(--accent-dark); background: #f5fbf7; }
.button-secondary:hover:not(:disabled) { border-color: var(--accent); background: #eaf5ee; }
.button-quiet { border-color: var(--line); color: var(--muted); background: #fff; }
.button-quiet:hover:not(:disabled) { border-color: #aebabc; color: var(--ink); }
.input-footnote { margin: 13px 0 0; color: var(--muted); font-size: .73rem; }

.control-rail { border-radius: 12px var(--radius-lg) var(--radius-lg) var(--radius-lg); overflow: hidden; }
.rail-block { padding: 24px; }
.rail-block + .rail-block { border-top: 1px solid var(--line); }
.rail-block h3 { margin-bottom: 11px; }
.rail-block p { margin-bottom: 17px; color: var(--muted); font-size: .82rem; }
.limit-fields { display: grid; gap: 10px; }
.limit-fields label { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #506066; font-size: .78rem; font-weight: 750; }
.limit-fields input { width: 104px; min-height: 42px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fbfcfc; font-size: 16px; }
.compact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.compact-actions .button { min-height: 42px; padding-inline: 7px; font-size: .72rem; }
.rail-tip { display: flex; gap: 11px; padding: 17px 21px; border-top: 1px solid var(--line); background: #fffdf4; }
.rail-tip > span { color: #c79320; font-size: 1.2rem; }
.rail-tip p { margin: 0; color: #7d683a; font-size: .77rem; line-height: 1.6; }
.rail-tip strong { color: #5a481f; }
.status { min-height: 28px; margin: 15px 4px 0; color: var(--muted); font-size: .83rem; }
.status.is-error { color: #ac3c36; }
.status.is-success { color: var(--accent-dark); }
.status.is-limit { color: #936a1c; }

.solution { padding: 114px 0 0; }
.solution-layout { display: grid; grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr); gap: 18px; }
.preview-panel, .moves-panel { border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 32px); }
.preview-panel { background: #f1f8f3; }
.preview-header { color: var(--muted); font-size: .79rem; font-weight: 750; }
.preview-cube { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: min(100%, 250px); margin: 36px auto 24px; }
.mini-face { padding: 6px; border: 1px solid rgba(25,35,41,.12); border-radius: 9px; background: rgba(255,255,255,.6); }
.mini-face:nth-child(1) { grid-column: 1 / 2; }
.mini-face:nth-child(2) { grid-column: 2 / 3; }
.mini-face:nth-child(3) { grid-column: 3 / 4; }
.mini-face:nth-child(4) { grid-column: 1 / 2; }
.mini-face:nth-child(5) { grid-column: 2 / 3; }
.mini-face:nth-child(6) { grid-column: 3 / 4; }
.mini-face-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .6rem; font-weight: 850; text-align: center; }
.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.mini-grid > :nth-child(1) { grid-column: 1; grid-row: 1; }
.mini-grid > :nth-child(2) { grid-column: 2; grid-row: 1; }
.mini-grid > :nth-child(3) { grid-column: 2; grid-row: 2; }
.mini-grid > :nth-child(4) { grid-column: 1; grid-row: 2; }
.mini-sticker { min-width: 0; aspect-ratio: 1; border-radius: 3px; border: 1px solid rgba(25,35,41,.12); }
.preview-caption { min-height: 48px; color: #577065; font-size: .8rem; }
.step-actions { display: flex; gap: 8px; margin-top: 18px; }
.step-actions .button { flex: 1; }
.moves-panel { min-width: 0; }
.moves-meta { padding-top: 4px; color: var(--muted); font-size: .75rem; }
.move-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 9px; margin-top: 26px; }
.move-card { min-height: 92px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfc; }
.move-card.is-current { border-color: var(--accent); background: var(--mint); box-shadow: 0 0 0 3px rgba(20,123,86,.1); }
.move-number { display: block; color: var(--muted); font-size: .68rem; font-weight: 800; }
.move-token { display: block; margin-top: 8px; color: var(--ink); font-size: 1.45rem; font-weight: 900; letter-spacing: -.04em; }
.move-face { display: block; margin-top: 2px; color: var(--accent-dark); font-size: .73rem; font-weight: 850; }
.move-explanation { display: block; margin-top: 5px; color: var(--muted); font-size: .68rem; line-height: 1.4; }
.move-legend { margin: 11px 0 0; color: var(--muted); font-size: .74rem; }
.empty-result { grid-column: 1 / -1; margin: 0; padding: 22px; border: 1px dashed #cfd9da; border-radius: 11px; color: var(--muted); font-size: .84rem; text-align: center; }

.how-to { padding: 126px 0 114px; display: grid; grid-template-columns: .65fr 1.35fr; gap: 64px; }
.how-intro h2, .limits h2 { margin-bottom: 0; font-size: clamp(1.8rem, 3vw, 2.8rem); }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how-grid article { padding: 22px 20px; border-top: 2px solid var(--ink); }
.how-grid article > span { color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.how-grid h3 { margin: 18px 0 9px; font-size: 1.05rem; }
.how-grid p { margin: 0; color: var(--muted); font-size: .8rem; }
.limits { margin-bottom: 114px; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: .65fr 1.35fr; gap: 64px; }
.limits p { margin: 0; color: var(--muted); font-size: .9rem; }
.site-footer { width: min(1240px, calc(100% - 48px)); margin: 0 auto; min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .75rem; }
.site-footer span:first-child { color: var(--ink); font-weight: 850; }
.site-footer a { text-underline-offset: 4px; }

:focus-visible { outline: 3px solid #f2b95c; outline-offset: 3px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; margin-top: 15px; gap: 28px; }
  .hero-copy { max-width: 720px; }
  .hero-art { max-width: 720px; }
  .workbench-layout { grid-template-columns: 1fr; }
  .control-rail { display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px 12px var(--radius-lg) var(--radius-lg); }
  .rail-tip { grid-column: 1 / -1; }
  .rail-block + .rail-block { border-top: 0; border-left: 1px solid var(--line); }
  .how-to, .limits { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 620px) {
  .site-header, .hero, .workbench, .solution, .how-to, .limits, .site-footer { width: min(100% - 28px, 1240px); }
  .site-header { min-height: 68px; }
  .header-link { display: none; }
  .hero { margin-bottom: 58px; }
  h1 { font-size: clamp(2.35rem, 12vw, 3.9rem); }
  .hero-lead { font-size: .95rem; }
  .hero-art img { border-radius: 22px 22px 22px 5px; }
  .art-caption { left: 11px; bottom: 10px; font-size: .66rem; }
  .section-heading { display: block; }
  .section-note { margin-top: 13px; font-size: .82rem; }
  .input-desk, .preview-panel, .moves-panel { padding: 19px; }
  .desk-heading { display: block; }
  .desk-hint { margin-top: 9px; }
  .orientation-note { font-size: .76rem; }
  .face-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .face-panel { padding: 9px; }
  .sticker { min-width: 44px; }
  .desk-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .desk-actions .button-primary { grid-column: 1 / -1; }
  .control-rail { display: block; }
  .rail-block + .rail-block { border-top: 1px solid var(--line); border-left: 0; }
  .compact-actions { grid-template-columns: 1fr 1fr; }
  .solution { padding-top: 75px; }
  .solution-layout { grid-template-columns: 1fr; }
  .preview-cube { margin-top: 25px; }
  .how-to { padding: 80px 0; }
  .how-grid { grid-template-columns: 1fr; gap: 7px; }
  .how-grid article { padding: 18px 0; }
  .how-grid h3 { margin-top: 7px; }
  .limits { margin-bottom: 65px; }
  .site-footer { min-height: 82px; flex-wrap: wrap; padding: 20px 0; }
}

@media (max-width: 350px) {
  .brand { font-size: .86rem; }
  .hero-notes span { font-size: .7rem; }
  .palette { display: block; }
  .palette-label { display: block; margin-bottom: 8px; }
  .color-choice { padding-inline: 8px; font-size: .74rem; }
  .face-title { font-size: .75rem; }
  .sticker { min-width: 40px; }
  .desk-actions { display: block; }
  .desk-actions .button { width: 100%; margin-bottom: 7px; }
  .compact-actions { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .hero-art, .palette, .desk-actions, .control-rail, .step-actions, .how-to, .site-footer { display: none !important; }
  body, .input-desk, .preview-panel, .moves-panel { background: #fff; box-shadow: none; }
  .hero, .workbench, .solution, .limits { width: 100%; margin: 0; padding: 18px 0; }
  .hero { display: block; }
  .hero-copy { max-width: 620px; }
  .workbench-layout, .solution-layout { display: block; }
  .moves-panel { margin-top: 16px; }
}

.not-found { width: min(700px, calc(100% - 48px)); margin: 15vh auto; }
.not-found h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
.not-found h1 em { color: var(--accent); font-style: normal; }
.not-found p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }
