:root {
  color-scheme: light;
  --paper: #f8f6ef;
  --surface: #fffdf8;
  --ink: #26241d;
  --subtle: #625d50;
  --line: #ded9ca;
  --orange: #c6432b;
  --orange-soft: #f6d2c0;
  --green: #23513e;
  --radius: 22px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-width: 280px; min-height: 100vh; margin: 0; display: flex; flex-direction: column; word-break: keep-all; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:not(:disabled) { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #9b4b23; outline-offset: 4px; }
h1:focus { outline: none; }
.frame { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 73px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 850; letter-spacing: -.045em; white-space: nowrap; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); place-content: center; gap: 3px; width: 34px; height: 34px; background: var(--ink); border-radius: 10px; transform: rotate(-6deg); }
.brand-mark i { background: #fff3d7; border-radius: 2px; }
.brand-mark i:nth-child(2) { background: #f58663; border-radius: 50%; }
.brand-mark i:nth-child(3) { border-radius: 5px 2px 2px; }
.help-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--subtle); font-size: 13px; font-weight: 700; white-space: nowrap; }
.help-button:hover { background: #efebdf; color: var(--ink); }
.help-button span { width: 16px; height: 16px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 10px; line-height: 1; }

#app { flex: 1; }
.hero { padding: 85px 0 71px; text-align: center; }
.hero h1 { font-size: clamp(53px, 7.6vw, 106px); line-height: 1.045; letter-spacing: -.09em; font-weight: 900; }
.hero em { position: relative; display: inline-block; padding-right: .075em; color: var(--orange); font-style: normal; }
.hero em::after { position: absolute; right: -12%; top: -.07em; content: "✦"; color: var(--orange); font: 400 .28em/1 Georgia, serif; }
.hero p { margin-top: 22px; color: var(--subtle); font-size: clamp(14px, 2vw, 17px); line-height: 1.65; letter-spacing: -.022em; }
.section-heading { display: flex; align-items: center; gap: 19px; margin-bottom: 18px; }
.section-heading h2 { font-size: 19px; font-weight: 850; letter-spacing: -.045em; }
.heading-line { height: 1px; flex: 1; background: var(--line); }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.game-tile { position: relative; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.game-tile:hover { transform: translateY(-5px); box-shadow: 0 12px 22px #34291915; border-color: #c4bcaa; }
.tile-art { position: relative; height: clamp(164px, 19vw, 236px); display: grid; place-items: center; isolation: isolate; overflow: hidden; }
.tile-art::before { position: absolute; inset: 0; z-index: -1; content: ""; }
.game-sudoku .tile-art { background: #f1d888; }
.game-sudoku .tile-art::before { background-image: linear-gradient(#806a2b1c 1px, transparent 1px), linear-gradient(90deg, #806a2b1c 1px, transparent 1px); background-size: 26px 26px; background-position: center; mask-image: radial-gradient(ellipse at center, #000, #0008); }
.game-solitaire .tile-art { background: #edc7cf; }
.game-solitaire .tile-art::before { background: radial-gradient(ellipse at center, transparent 46%, #79434923 46.5%, transparent 47%, transparent 51%, #79434923 51.5%, transparent 52%, transparent 56%, #79434923 56.5%, transparent 57%); }
.game-freecell .tile-art { background: #c5d9b9; }
.game-freecell .tile-art::before { background-image: radial-gradient(#3e624238 1px, transparent 1px); background-size: 15px 15px; }
.tile-caption { position: relative; padding: 22px 23px 24px; min-height: 132px; }
.tile-label { color: var(--subtle); font-size: 12px; font-weight: 750; letter-spacing: -.01em; }
.tile-caption h3 { margin-top: 4px; padding-right: 45px; font-size: clamp(24px, 3vw, 33px); font-weight: 850; line-height: 1.16; letter-spacing: -.075em; }
.tile-caption p { margin-top: 8px; color: var(--subtle); font-size: 13px; line-height: 1.55; letter-spacing: -.025em; }
.tile-arrow { position: absolute; top: 24px; right: 20px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 20px; line-height: 1; transition: background .18s, color .18s, border-color .18s; }
.game-tile:is(:hover, :focus-visible) .tile-arrow { color: white; background: var(--ink); border-color: var(--ink); }
.art-sparkle { position: absolute; font: 400 26px/1 Georgia, serif; color: var(--art-ink, #5b4524); }
.sparkle-one { top: 22%; right: 21%; }
.sparkle-two { bottom: 21%; left: 20%; font-size: 21px; }
.sudoku-art { display: grid; grid-template-columns: repeat(3, 1fr); width: 42%; max-width: 153px; aspect-ratio: 1; gap: 1px; padding: 2px; border: 2px solid #332b20; border-radius: 10px; background: #332b20; transform: rotate(-12deg); box-shadow: 8px 8px 0 #937b3d59; }
.sudoku-art span { display: grid; place-items: center; background: #fff7da; color: #322a22; font-size: clamp(15px, 2.15vw, 29px); font-weight: 850; line-height: 1; }
.sudoku-art span:first-child { border-radius: 5px 0 0; }
.sudoku-art span:nth-child(3) { border-radius: 0 5px 0 0; }
.sudoku-art span:nth-child(7) { border-radius: 0 0 0 5px; }
.sudoku-art span:nth-child(9) { border-radius: 0 0 5px; }
.sudoku-art .art-chosen { background: #b44b34; color: #fff7da; }
.art-card { width: 30%; max-width: 104px; aspect-ratio: 3 / 4; position: absolute; top: 50%; left: 50%; display: grid; place-items: center; border: 1.5px solid #312822; border-radius: 10px; background: #fffaec; box-shadow: 4px 5px 0 #2e221835; font-family: Georgia, serif; }
.art-card > span { position: absolute; top: 7%; left: 10%; font-size: clamp(13px, 1.6vw, 21px); font-weight: 700; line-height: .95; }
.art-card small { display: block; font-size: .66em; line-height: 1.1; }
.art-card b { font-size: clamp(30px, 5vw, 62px); font-weight: 400; line-height: 1; }
.klondike-back { transform: translate(-82%, -50%) rotate(-17deg); background-color: #a83e53; background-image: repeating-linear-gradient(45deg, transparent 0 6px, #ffdfeb65 6px 7px), repeating-linear-gradient(-45deg, transparent 0 6px, #ffdfeb65 6px 7px); box-shadow: inset 0 0 0 5px #fff2e9, 4px 5px 0 #2e221835; }
.klondike-front { transform: translate(-23%, -46%) rotate(13deg); color: #ae364c; }
.game-solitaire .art-sparkle { --art-ink: #8f344b; }
.freecell-slots { position: absolute; top: 17%; left: 23%; right: 23%; display: flex; justify-content: center; gap: 7px; transform: rotate(-6deg); }
.freecell-slots i { width: 26%; aspect-ratio: 4 / 5; border: 1px dashed #4d694b9e; border-radius: 7px; background: #e5f0d73b; }
.freecell-back { transform: translate(-84%, -31%) rotate(-17deg); color: #a93932; }
.freecell-front { transform: translate(-24%, -38%) rotate(11deg); color: #254b37; background: #f8f8e7; }
.game-freecell .art-sparkle { top: 30%; right: 15%; --art-ink: #365e40; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 48px; padding-block: 19px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 12px; font-weight: 650; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

.game-view { margin: 0 auto; max-width: 950px; }
.game-view-sudoku { max-width: 810px; }
.game-heading { padding: 35px 0 26px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--subtle); font-size: 13px; font-weight: 740; }
.back-link:hover { color: var(--orange); }
.back-link span { font-size: 17px; line-height: 1; }
.game-heading h1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 13px; margin-top: 11px; font-size: clamp(42px, 6vw, 62px); line-height: 1.05; letter-spacing: -.075em; font-weight: 900; }
.game-heading h1 span { color: var(--subtle); font-family: Georgia, serif; font-size: .33em; font-style: italic; font-weight: 400; letter-spacing: -.025em; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 10px; margin-bottom: 13px; }
.game-stat { display: inline-flex; align-items: center; gap: 5px; color: var(--subtle); font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-icon { color: var(--orange); font-size: 19px; line-height: 1; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 14px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; font-size: 13px; font-weight: 780; white-space: nowrap; }
.primary-button { background: var(--ink); color: #fffdf6; }
.primary-button:hover { background: #464034; }
.secondary-button { background: var(--surface); border-color: var(--line); color: var(--ink); }
.secondary-button:hover:not(:disabled) { background: #efe9dc; }
button:disabled { opacity: .55; }
.game-message { min-height: 1.4em; color: var(--subtle); font-size: 13px; line-height: 1.4; }
.game-message.is-won { color: var(--green); font-weight: 850; }
.keyboard-hint { color: var(--subtle); font-size: 12px; line-height: 1.45; }

.sudoku-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: start; gap: 27px; }
.sudoku-toolbar { margin-bottom: 10px; }
.level-options { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); background: #eeeade; border-radius: 10px; }
.level-options button { min-height: 33px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--subtle); font-size: 13px; font-weight: 740; }
.level-options button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #4e392b26; }
.level-options button:hover { color: var(--ink); }
.sudoku-board { overflow: hidden; border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); }
.sudoku-row { display: grid; grid-template-columns: repeat(9, 1fr); }
.sudoku-cell { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: #9c3d26; font-size: clamp(17px, 3.5vw, 31px); font-weight: 670; line-height: 1; font-variant-numeric: tabular-nums; }
.sudoku-cell:is(:nth-child(3), :nth-child(6)) { border-right: 2px solid var(--ink); }
.sudoku-row:is(:nth-child(3), :nth-child(6)) .sudoku-cell { border-bottom: 2px solid var(--ink); }
.sudoku-cell:last-child { border-right: 0; }
.sudoku-row:last-child .sudoku-cell { border-bottom: 0; }
.sudoku-cell.is-given { color: var(--ink); font-weight: 790; }
.sudoku-cell.is-related { background: #f5eddc; }
.sudoku-cell.is-match { background: #f3dfb0; }
.sudoku-cell.is-conflict { color: #9a2020; background: #f6c9c5; }
.sudoku-cell.is-selected { background: #f2c2ac; box-shadow: inset 0 0 0 2px #b54b31; }
.sudoku-cell:focus-visible { z-index: 1; outline-offset: -4px; }
.sudoku-notes { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); align-items: center; color: var(--subtle); font-size: clamp(8px, 1.4vw, 12px); line-height: 1; }

.sudoku-panel { display: grid; justify-items: stretch; gap: 14px; }
.new-game { justify-content: space-between; padding-inline: 16px; }
.new-game > span { font-size: 17px; line-height: 1; }
.sudoku-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.action-tile { display: grid; gap: 3px; align-content: center; justify-items: center; min-height: 58px; padding: 3px 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--subtle); font-size: 11px; font-weight: 750; white-space: nowrap; }
.action-tile > span[aria-hidden] { font-size: 19px; line-height: 1; color: var(--ink); }
.action-tile[aria-pressed="true"] { background: #f6ddca; border-color: #c46748; color: #6f2e1c; }
.action-tile:hover:not(:disabled), .number-pad button:hover:not(:disabled) { background: #f3e8d8; }
.number-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.number-pad button { min-width: 0; height: 57px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font-size: 24px; font-weight: 790; }
.sudoku-panel .game-message:empty { display: none; }

.card-tools { flex-wrap: wrap; }
.card-metrics, .card-tool-buttons { display: flex; gap: 13px; align-items: center; }
.card-metrics .game-stat + .game-stat { padding-left: 13px; border-left: 1px solid var(--line); }
.card-metrics .move-count { gap: 0; }
.card-tool-buttons { gap: 7px; }
.card-table { --card-width: clamp(56px, 8vw, 88px); --card-height: calc(var(--card-width) * 1.35); --card-gap: clamp(4px, 1.35vw, 15px); --stack-step: clamp(19px, 3.2vw, 30px); padding: clamp(14px, 4vw, 44px); border: 1px solid #214934; border-radius: 19px; background-color: var(--green); background-image: radial-gradient(#f4ffea17 .7px, transparent .7px); background-size: 6px 6px; box-shadow: inset 0 0 100px #071e1d50; }
.card-top, .tableau { width: max-content; margin-inline: auto; }
.card-top { display: flex; justify-content: space-between; gap: var(--card-gap); margin-bottom: clamp(15px, 3.3vw, 32px); }
.klondike-table .card-top { width: calc(var(--card-width) * 7 + var(--card-gap) * 6); }
.freecell-table .card-top { width: calc(var(--card-width) * 8 + var(--card-gap) * 7); }
.card-piles, .tableau { display: flex; gap: var(--card-gap); align-items: flex-start; }
.tableau { min-height: calc(var(--card-height) + var(--stack-step) * 5); }
.playing-card, .card-slot { position: relative; display: grid; place-items: center; flex: none; width: var(--card-width); height: var(--card-height); padding: 0; border: 1px solid transparent; border-radius: clamp(4px, .7vw, 9px); }
.playing-card { border-color: #e3d8bd; background: #fff8e6; color: #292b25; box-shadow: 0 2px 4px #0c201956; user-select: none; }
.playing-card[draggable="true"] { cursor: grab; }
.playing-card[draggable="true"]:active { cursor: grabbing; }
.playing-card.red-suit { color: #ae3539; }
.card-corner { position: absolute; top: 5%; left: 8%; display: grid; justify-items: center; font-size: clamp(11px, calc(var(--card-width) * .23), 22px); font-weight: 800; line-height: 1; pointer-events: none; }
.card-corner small { font-family: Georgia, serif; font-size: .75em; }
.card-corner-end { top: auto; left: auto; right: 8%; bottom: 5%; transform: rotate(180deg); }
.card-suit { font-family: Georgia, serif; font-size: calc(var(--card-width) * .53); line-height: 1; pointer-events: none; }
.card-slot { border: 1px dashed #b6d0a8aa; background: #14382650; color: #d6e7c8; font: 500 calc(var(--card-width) * .42)/1 Georgia, serif; }
.card-slot.red-suit { color: #ffd2c9; }
.empty-waste { opacity: .7; }
.face-down { border: 2px solid #f7ead0; background-color: #bb593e; background-image: repeating-linear-gradient(45deg, transparent 0 5px, #ffecd66c 5px 6px), repeating-linear-gradient(-45deg, transparent 0 5px, #ffecd66c 5px 6px); box-shadow: inset 0 0 0 2px #98422d, 0 1px 2px #13261ba6; }
.stock-button.face-down span { display: grid; place-items: center; min-width: 55%; aspect-ratio: 1; border: 1px solid #e8a888; border-radius: 50%; background: #8c392b; color: #fff4df; font: 770 clamp(11px, 2vw, 18px)/1 system-ui, sans-serif; }
.tableau-pile { position: relative; flex: none; width: var(--card-width); min-height: calc(var(--card-height) + var(--last-step) * var(--stack-step)); }
.tableau-pile .playing-card { position: absolute; top: calc(var(--step, 0) * var(--stack-step)); left: 0; }
.tableau-pile .playing-card:not(:last-child) .card-corner:not(.card-corner-end) { display: flex; align-items: baseline; gap: .19em; }
.playing-card.is-selected { border-color: #a34823; background: #ffdf9b; box-shadow: inset 0 0 0 1px #ac4f23, 0 0 0 2px #ffc878; }
.playing-card:focus-visible, .card-slot:focus-visible, .is-drop-target { outline: 2px solid #fcd78a; outline-offset: 2px; }
.card-message { margin-top: 12px; }
.card-message:empty { display: none; }
.card-hint { margin-top: 10px; text-align: center; }
.touch-hint { display: none; }

@media (pointer: coarse) {
  .keyboard-hint:not(.card-hint), .pointer-hint { display: none; }
  .touch-hint { display: inline; }
}

.dialog { width: min(480px, calc(100% - 34px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 14px 45px #2a1e1838; }
.dialog::backdrop { background: #21170b75; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dialog-top h2 { font-size: 22px; font-weight: 850; letter-spacing: -.05em; }
.close-button { width: 33px; height: 33px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 23px; line-height: 1; }
.close-button:hover { background: #f0ebdf; }
.dialog p, .rule-list { color: var(--subtle); font-size: 14px; line-height: 1.65; }
.rule-list { display: grid; gap: 9px; padding-left: 21px; margin: 0 0 5px; }
.dialog-actions, .help-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.dialog-actions { justify-content: flex-end; }
.rule-list + .primary-button { margin-top: 16px; }

@media (max-width: 860px) {
  .frame { width: calc(100% - 48px); }
  .game-grid { gap: 12px; }
  .tile-caption { padding-inline: 17px; }
  .tile-arrow { right: 15px; width: 34px; height: 34px; }
  .card-table { --card-width: min(10vw, 77px); --card-gap: min(1.25vw, 11px); padding-inline: 10px; }
}

@media (max-width: 620px) {
  .frame { width: calc(100% - 32px); }
  .header-inner { min-height: 62px; }
  .hero { padding: 53px 5px 43px; }
  .hero h1 { font-size: clamp(47px, 11.2vw, 66px); }
  .hero p { max-width: 300px; margin: 14px auto 0; }
  .game-grid { grid-template-columns: 1fr; gap: 12px; }
  .game-tile { display: grid; grid-template-columns: 39% 1fr; border-radius: 15px; }
  .tile-art { height: 100%; min-height: 139px; }
  .tile-caption { min-height: 139px; padding: 16px 12px; }
  .tile-caption h3 { padding-right: 24px; }
  .tile-caption p { font-size: 12px; }
  .tile-arrow { top: 12px; right: 10px; width: 26px; height: 26px; font-size: 15px; }
  .art-sparkle { font-size: 17px; }
  .sparkle-two { left: 13%; bottom: 16%; font-size: 14px; }
  .sudoku-art { width: 54%; }
  .art-card { width: 38%; border-radius: 5px; }
  .art-card b { font-size: 28px; }
  .site-footer { margin-top: 38px; }
  .game-heading { padding: 24px 0 15px; }
  .game-heading h1 { margin-top: 8px; }
  .sudoku-layout { grid-template-columns: 1fr; gap: 13px; max-width: 460px; }
  .sudoku-cell { font-size: clamp(16px, 5.3vw, 27px); }
  .sudoku-panel { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .sudoku-actions { grid-row: 1; grid-column: 1; }
  .new-game { grid-row: 1; grid-column: 2; padding-inline: 9px; }
  .action-tile { min-height: 45px; font-size: 10px; }
  .action-tile > span[aria-hidden] { font-size: 16px; }
  .number-pad { grid-column: 1 / -1; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .number-pad button { height: 40px; border-radius: 7px; font-size: 19px; }
  .sudoku-panel .game-message, .sudoku-panel .keyboard-hint { grid-column: 1 / -1; }
  .card-table { --card-width: calc((100vw - 78px) / 8); --card-gap: 4px; --stack-step: clamp(12px, 4.3vw, 24px); padding: 14px 8px; border-radius: 12px; }
  .klondike-table { --card-width: calc((100vw - 74px) / 7); }
  .card-tool-buttons { gap: 4px; }
  .card-tool-buttons :is(.secondary-button, .primary-button) { min-height: 37px; padding-inline: 9px; }
  .card-metrics { gap: 7px; }
  .card-metrics .game-stat + .game-stat { padding-left: 7px; }
  .card-corner-end { display: none; }
}

@media (max-width: 350px) {
  .game-tile { grid-template-columns: 35% 1fr; }
  .tile-caption { min-height: 123px; }
  .tile-art { min-height: 123px; }
  .card-corner { font-size: 9px; }
  .face-down { border-width: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.game-nonogram .tile-art { background: #ddd0ed; }
.game-nonogram .tile-art::before { background: radial-gradient(#684b8e38 1px, transparent 1px); background-size: 16px 16px; }
.game-nonogram .art-sparkle { --art-ink: #5d477c; }
.nonogram-art, .mine-art {
  display: grid;
  width: 44%;
  max-width: 150px;
  aspect-ratio: 1;
  padding: 2px;
  gap: 1px;
  border: 2px solid #382d45;
  border-radius: 10px;
  overflow: hidden;
  background: #382d45;
  box-shadow: 7px 8px 0 #513b6b43;
}
.nonogram-art { grid-template-columns: repeat(6, 1fr); transform: rotate(10deg); }
.nonogram-art span, .mine-art span { display: grid; place-items: center; background: #fcf1ff; color: #553c72; font-size: clamp(7px, 1.2vw, 15px); font-weight: 850; line-height: 1; }
.nonogram-art span:nth-child(-n + 6), .nonogram-art span:nth-child(6n + 1) { background: #e9d6f5; }
.nonogram-art span.art-painted { background: #8863ad; }
.game-minesweeper .tile-art { background: #bbd8e4; }
.game-minesweeper .tile-art::before { background-image: linear-gradient(45deg, transparent 49%, #31516422 49%, #31516422 51%, transparent 51%); background-size: 22px 22px; }
.game-minesweeper .art-sparkle { --art-ink: #355b70; }
.mine-art { grid-template-columns: repeat(3, 1fr); transform: rotate(-11deg); border-color: #2c444d; background: #2c444d; box-shadow: 7px 8px 0 #27485442; }
.mine-art span { color: #285777; background: #ecf5ef; font-size: clamp(13px, 2vw, 26px); }
.mine-art .art-flag { color: #a03635; background: #d3e7ea; }
.mine-art .art-bomb { color: #682e20; background: #f3b99e; }

.game-view-nonogram, .game-view-minesweeper { max-width: 805px; }
.grid-game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: start; gap: 27px; }
.grid-game-panel { display: grid; gap: 12px; }
.grid-game-panel .game-message:empty { display: none; }
.grid-game-panel .game-message.is-lost { color: #932f2a; font-weight: 750; }
.puzzle-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.puzzle-mode-options .action-tile { min-height: 56px; font-size: 12px; }
.puzzle-mode-options .action-tile > span { font-size: 21px; }

.nonogram-board {
  --clue-line: #d4c6e0;
  --puzzle-line: #dfd6e7;
  --puzzle-rule: #625070;
  display: grid;
  max-width: 520px;
  grid-template-columns: var(--clue-width) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--puzzle-rule);
  border-radius: 12px;
  background: #ede4f1;
}
.nonogram-board::before { content: ""; background: #e0d1e8; }
.nonogram-column-clues { display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); border-inline-start: 1px solid var(--puzzle-rule); }
.nonogram-row-clues { display: grid; grid-template-rows: repeat(var(--size), minmax(0, 1fr)); border-top: 1px solid var(--puzzle-rule); }
.nonogram-clue {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .32em;
  padding: 4px;
  background: #f0e8f4;
  color: #573872;
  font-size: clamp(10px, 1.9vw, 15px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.06;
}
.nonogram-clue.is-complete { color: #64596b; background: #e8deec; }
.nonogram-column-clues .nonogram-clue { flex-direction: column; border-right: 1px solid var(--clue-line); }
.nonogram-row-clues .nonogram-clue { border-bottom: 1px solid var(--clue-line); }
.nonogram-column-clues .nonogram-clue:last-child, .nonogram-row-clues .nonogram-clue:last-child { border: 0; }
.nonogram-grid { display: grid; grid-template-rows: repeat(var(--size), minmax(0, 1fr)); aspect-ratio: 1; border-top: 1px solid var(--puzzle-rule); border-left: 1px solid var(--puzzle-rule); background: var(--surface); }
.nonogram-row, .mine-row { display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); }
.nonogram-cell, .mine-cell {
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  touch-action: manipulation;
  line-height: 1;
}
.nonogram-cell { border-right: 1px solid var(--puzzle-line); border-bottom: 1px solid var(--puzzle-line); background: transparent; color: #72627e; font-size: clamp(14px, 3vw, 30px); }
.nonogram-cell:last-child { border-right: 0; }
.nonogram-row:last-child .nonogram-cell { border-bottom: 0; }
.nonogram-cell:nth-child(5):not(:last-child), .nonogram-column-clues .nonogram-clue:nth-child(5):not(:last-child) { border-right-color: var(--puzzle-rule); }
.nonogram-row:nth-child(5):not(:last-child) .nonogram-cell, .nonogram-row-clues .nonogram-clue:nth-child(5):not(:last-child) { border-bottom-color: var(--puzzle-rule); }
.nonogram-cell.is-filled { background: #7752a0; border-color: #e8d8f17d; }
.nonogram-cell.is-crossed { background: #f6eff7; }
.nonogram-board.is-complete .nonogram-cell.is-filled { background: #5e4087; }
.nonogram-cell:focus-visible, .mine-cell:focus-visible { position: relative; z-index: 1; outline-offset: -3px; }
@media (hover: hover) {
  .nonogram-cell:not(.is-filled):hover { background: #f0e4f7; }
  .mine-cell:not(.is-open):hover { background: #d3e6e7; }
}

.mine-metrics { display: flex; align-items: center; gap: 11px; }
.flag-icon { color: #b33d35; font-family: Georgia, serif; font-size: 18px; line-height: 1; }
.mine-board {
  --mine-line: #8ca6aa;
  display: grid;
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  overflow: hidden;
  max-width: 525px;
  aspect-ratio: 1;
  border: 2px solid #345660;
  border-radius: 12px;
  background: #e7eeeb;
}
.mine-cell {
  border-right: 1px solid var(--mine-line);
  border-bottom: 1px solid var(--mine-line);
  background: #c3d8d9;
  color: #174b6d;
  box-shadow: inset 1px 1px #ffffff85;
  font-size: clamp(13px, 2.7vw, 27px);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.mine-cell:last-child { border-right: 0; }
.mine-row:last-child .mine-cell { border-bottom: 0; }
.mine-cell.is-open { background: #f0f2e9; border-color: #b9c8c7; box-shadow: none; cursor: default; }
.mine-cell.is-open[data-number] { cursor: pointer; }
.mine-cell.is-flagged { color: #a03b2c; }
.mine-cell.is-mine { background: #f1d8cc; color: #572a21; }
.mine-cell.is-exploded { background: #a93031; color: #fff9eb; }
.mine-cell.is-missed { background: #f6d9b3; color: #7e2620; }
.mine-cell[data-number="2"] { color: #296249; }
.mine-cell[data-number="3"] { color: #a03330; }
.mine-cell[data-number="4"], .mine-cell[data-number="5"] { color: #674984; }
.mine-cell[data-number="6"], .mine-cell[data-number="7"], .mine-cell[data-number="8"] { color: #704027; }
.mine-board:has([aria-readonly="true"]) .mine-cell { cursor: default; }

.game-crossword .tile-art { background: #b7dcd6; }
.game-crossword .tile-art::before { background: radial-gradient(#2b63594a 1px, transparent 1px) center / 15px 15px; }
.game-crossword .art-sparkle { top: 25%; right: 17%; --art-ink: #285a53; }
.crossword-art {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 55%;
  max-width: 133px;
  aspect-ratio: 1;
  gap: 1px;
  padding: 4px;
  border-radius: 8px;
  background: #234743;
  transform: rotate(-9deg);
  box-shadow: 6px 7px 0 #23534e48;
}
.crossword-art span { display: grid; place-items: center; background: #fffaf0; color: #254d47; font: 800 clamp(9px, 1.3vw, 17px)/1 system-ui, sans-serif; }
.crossword-art span:nth-child(13) { background: #8fd2bf; }
.crossword-art .art-block { background: transparent; }

.game-view-crossword { max-width: 1020px; }
.crossword-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.crossword-toolbar { margin-bottom: 15px; }
.crossword-levels button { min-height: 36px; }
.crossword-levels small { margin-left: 2px; font-size: 11px; font-weight: 650; }
.crossword-puzzle-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.crossword-puzzle-heading h2 { font-size: 20px; font-weight: 850; letter-spacing: -.045em; }
.crossword-puzzle-heading .game-stat { font-size: 12px; }
.crossword-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 65px;
  margin-bottom: 8px;
  padding: 8px 10px 8px 12px;
  border: 1px solid #b4d4c8;
  border-radius: 9px;
  background: #e1f0e8;
  color: #264d43;
  font-size: 14px;
  line-height: 1.45;
}
.crossword-current-copy { min-width: 0; }
.crossword-current-copy small { white-space: nowrap; }
.crossword-current strong {
  display: inline-block;
  margin-right: 5px;
  padding: 3px 6px;
  border-radius: 5px;
  background: #286052;
  color: white;
  font-size: 12px;
  white-space: nowrap;
}
.crossword-clue-nav { display: flex; flex: none; gap: 4px; }
.crossword-clue-nav button { min-width: 37px; min-height: 37px; padding: 0; color: #286052; font: 700 23px/1 system-ui, sans-serif; }
.crossword-board {
  display: grid;
  grid-template-columns: repeat(var(--crossword-width), minmax(0, 1fr));
  container-type: inline-size;
  gap: 1px;
  padding: 5px;
  border-radius: 10px;
  background: #27433f;
}
.crossword-cell, .crossword-block { aspect-ratio: 1; }
.crossword-cell { position: relative; min-width: 0; border-radius: 2px; background: var(--surface); }
.crossword-cell > span {
  position: absolute;
  top: 2px;
  left: 3px;
  color: #34574f;
  font: 750 clamp(8px, calc(31cqi / var(--crossword-width)), 12px)/1 system-ui, sans-serif;
  pointer-events: none;
}
.crossword-cell input {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px 0 0;
  border: 0;
  border-radius: inherit;
  outline: none;
  background: transparent;
  color: #183c35;
  text-align: center;
  font: 800 clamp(16px, calc(62cqi / var(--crossword-width)), 30px)/1 system-ui, sans-serif;
}
.crossword-cell input::selection { background: transparent; }
.crossword-cell.is-word { background: #def3e9; }
.crossword-cell.is-selected { z-index: 1; background: #a6dfcd; }
.crossword-cell.is-mistake { background: #f8d6cb; }
.crossword-cell.is-mistake input { color: #8a3020; }
.crossword-cell.is-selected input, .crossword-cell input:focus-visible { box-shadow: inset 0 0 0 2px #246d60; }
.crossword-board.is-complete .crossword-cell { background: #d1ebd9; }
.crossword-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.crossword-progress progress {
  flex: 1;
  min-width: 0;
  height: 8px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  appearance: none;
  background: #e0e8df;
  color: #286052;
}
.crossword-progress progress::-webkit-progress-bar { background: #e0e8df; }
.crossword-progress progress::-webkit-progress-value { background: #286052; border-radius: 99px; }
.crossword-progress progress::-moz-progress-bar { background: #286052; border-radius: 99px; }
.crossword-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 10px; }
.crossword-hints-left {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #e1f0e8;
  color: #264d43;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.crossword-message { min-height: 0; margin-top: 8px; }
.crossword-message:empty { margin-top: 0; }
.crossword-clues { display: grid; gap: 16px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.crossword-clue-group { min-width: 0; }
.crossword-clue-group h2 {
  margin: 0 4px 6px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 850;
}
.crossword-clue-list { display: grid; gap: 2px; }
.crossword-clue {
  display: grid;
  grid-template-columns: 21px minmax(0, 1fr);
  gap: 5px;
  align-items: start;
  min-height: 44px;
  padding: 10px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
}
.crossword-clue-number { font-weight: 850; color: #286052; }
.crossword-clue small { color: var(--subtle); white-space: nowrap; }
.crossword-clue:hover { background: #f1f1e7; }
.crossword-clue[aria-pressed="true"] { border-color: #b4d4c8; background: #e1f0e8; }

@media (min-width: 1040px) {
  .crossword-clues { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 760px) {
  .game-view-crossword { max-width: 460px; }
  .crossword-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .crossword-clues { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 11px 8px; }
  .crossword-clue { grid-template-columns: 15px minmax(0, 1fr); gap: 3px; padding: 7px 4px; font-size: 13px; }
  .crossword-clue-group h2 { margin-inline: 2px; }
  .crossword-current { min-height: 74px; font-size: 13px; }
  .crossword-actions :is(.secondary-button, .primary-button) { padding-inline: 10px; }
}

@media (max-width: 380px) {
  .crossword-toolbar { gap: 4px; }
  .crossword-levels { gap: 1px; }
  .crossword-levels button { display: grid; align-content: center; gap: 2px; padding-inline: 8px; line-height: 1.1; }
  .crossword-levels small { margin: 0; }
  .crossword-toolbar > button { padding-inline: 9px; }
  .crossword-clue-nav button { min-width: 32px; min-height: 38px; }
  .crossword-cell > span { top: 1px; left: 2px; }
  .crossword-cell input { padding: 6px 0 0 1px; }
}

@media (min-width: 1080px) {
  .game-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .game-tile { grid-column: span 2; }
  .game-grid :is(.game-battle, .game-market) { grid-column: span 3; }
  .tile-art { height: 174px; }
  :is(.game-battle, .game-market) .tile-art { height: 151px; }
  .tile-caption { padding: 17px 14px 18px; }
  :is(.game-battle, .game-market) .tile-caption { min-height: 113px; }
  .tile-caption h3 { padding-right: 29px; font-size: 26px; }
  .tile-arrow { top: 17px; right: 10px; width: 30px; height: 30px; font-size: 17px; }
  .sudoku-art, .nonogram-art, .mine-art { width: min(53%, 130px); }
  .art-card { width: min(35%, 90px); }
  .art-card b { font-size: 43px; }
  .sudoku-art span { font-size: 21px; }
  .mine-art span { font-size: 21px; }
}

@media (max-width: 620px) {
  .nonogram-art, .mine-art { width: 56%; border-radius: 7px; box-shadow: 4px 5px 0 #352b4d40; }
  .grid-game-layout { max-width: 460px; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grid-game-panel { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .grid-game-panel > :is(.game-message, .keyboard-hint) { grid-column: 1 / -1; }
  .grid-game-panel .puzzle-mode-options { grid-row: 1; grid-column: 1; }
  .grid-game-panel .new-game { grid-row: 1; grid-column: 2; }
  .grid-game-panel > .secondary-button { grid-column: 1 / -1; }
  .puzzle-mode-options .action-tile { min-height: 48px; }
  .nonogram-clue { gap: .23em; }
  .mine-metrics { gap: 7px; }
}
@media (max-width: 350px) {
  .mine-metrics .game-stat { font-size: 12px; gap: 3px; }
  .game-view-minesweeper .level-options button { padding-inline: 8px; }
}

.game-battle .tile-art { background: #cbdadb; }
.game-battle .tile-art::before { background-image: radial-gradient(#264f582e 1px, transparent 1px); background-size: 16px 16px; }
.battle-art { display: flex; justify-content: center; align-items: center; gap: clamp(6px, 2.2vw, 18px); }
.battle-art-well {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: clamp(39px, 7.4vw, 77px);
  aspect-ratio: 5 / 7;
  gap: 1px;
  padding: 4px;
  border: 1px solid #193038;
  border-radius: 7px;
  background: #263b43;
  box-shadow: 4px 5px #32566439;
}
.battle-art-well i { border-radius: 1px; background: #354e56; }
.battle-art-first { transform: rotate(-12deg); }
.battle-art-second { transform: rotate(10deg); }
.battle-art b { color: #31515b; font-size: clamp(15px, 3vw, 28px); }
.battle-art i.battle-art-A { background: #ecba56; }
.battle-art i.battle-art-B { background: #e47c69; }
.battle-art i.battle-art-C { background: #67868d; }
.battle-art i.battle-art-D { background: #7ec3a7; }
.battle-art i.battle-art-E { background: #a994d0; }

.game-market .tile-art { background: #efd4ab; }
.game-market .tile-art::before { background: linear-gradient(150deg, #f6e3bf8f 30%, transparent 31%), repeating-linear-gradient(90deg, transparent 0 36px, #9f654414 36px 37px); }
.game-market .art-sparkle { --art-ink: #8c522e; right: 18%; top: 22%; }
.market-art { display: flex; align-items: flex-end; width: clamp(83px, 47%, 190px); gap: 3px; transform: rotate(-7deg); }
.market-art-shop {
  --shop-color: #c2634c;
  position: relative;
  width: 34%;
  aspect-ratio: 5 / 6;
  border: 2px solid #513d31;
  border-radius: 4px 4px 2px 2px;
  background: #fff0d1;
  box-shadow: 3px 5px #51352c35;
}
.market-art-shop:nth-child(2) { --shop-color: #68875f; aspect-ratio: 5 / 7; }
.market-art-shop:nth-child(3) { --shop-color: #bd8b43; }
.market-art-shop i { position: absolute; top: 27%; inset-inline: -8%; height: 25%; border: 1px solid #513d31; border-radius: 3px 3px 6px 6px; background: repeating-linear-gradient(90deg, var(--shop-color) 0 19%, #fff2d4 19% 33%); }
.market-art-shop span { position: absolute; bottom: 0; left: 34%; width: 36%; height: 34%; border: 1px solid #513d31; border-bottom: 0; border-radius: 3px 3px 0 0; background: var(--shop-color); }

.game-view-battle { max-width: 860px; }
.battle-layout { display: grid; grid-template-columns: minmax(0, 1fr) 190px; align-items: start; gap: 23px; }
.battle-match-bar { display: flex; align-items: center; gap: 15px; min-height: 35px; padding-bottom: 8px; }
.battle-match-bar .battle-message { font-weight: 750; }
.battle-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.battle-field { min-width: 0; padding: 10px; border: 1px solid #cbd2c8; border-radius: 13px; background: #edece3; }
.battle-field-cpu { border-color: #d4ccc3; background: #efe8df; }
.battle-field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; padding: 0 2px 8px; font-size: 12px; color: var(--subtle); }
.battle-field-heading h2 { color: var(--ink); font-size: 15px; font-weight: 850; }
.battle-board, .battle-preview-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(16, minmax(0, 1fr));
  aspect-ratio: 9 / 16;
  gap: 1px;
  padding: 3px;
  border: 1px solid #192c32;
  border-radius: 7px;
  background: #1d2d33;
  outline-offset: 2px;
}
.battle-board > span, .battle-preview-grid > span { background: var(--block-color, #263b42); border-radius: 1px; }
.battle-board > span[class^="block-color-"], .battle-preview-grid > span[class^="block-color-"] { box-shadow: inset 1px 1px #ffffff38, inset -1px -1px #0003; }
.battle-board > .block-active { outline: 1px solid #ffffff69; outline-offset: -2px; }
.battle-stage[data-battle-status="paused"] .battle-board { opacity: .72; }
.block-color-1 { --block-color: #e8bb60; }
.block-color-2 { --block-color: #79baa0; }
.block-color-3 { --block-color: #e6816e; }
.block-color-4 { --block-color: #c4a3dc; }
.block-color-5 { --block-color: #ed9c62; }
.block-color-6 { --block-color: #7eabd1; }
.block-color-7 { --block-color: #99bf6f; }
.block-color-8 { --block-color: #d799b3; }
.block-color-9 { --block-color: #647980; }
.battle-board > .block-ghost { background: #374c53; outline: 1px dashed #abc1bd80; outline-offset: -2px; }
.battle-pressure { display: flex; flex-wrap: wrap; gap: 4px 11px; justify-content: space-between; padding: 8px 2px 0; color: var(--subtle); font-size: 11px; font-weight: 660; }
.battle-pressure .has-pressure { color: #963c2d; font-weight: 850; }
.battle-panel { display: grid; gap: 12px; padding-top: 35px; }
.battle-preview { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.battle-preview h2 { color: var(--subtle); font-size: 12px; font-weight: 780; }
.battle-preview-grid { width: 47px; flex: none; aspect-ratio: 1; grid-template: repeat(3, 1fr) / repeat(3, 1fr); border-radius: 4px; }
.battle-buttons { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
.battle-buttons button { padding-inline: 9px; }
.battle-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.battle-controls .action-tile { min-height: 49px; touch-action: manipulation; }
.battle-controls .action-tile:last-child { grid-column: span 2; }

@media (min-width: 621px) and (max-width: 1079px) {
  .game-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .game-tile { grid-column: span 2; }
  .game-grid :is(.game-battle, .game-market) { grid-column: span 3; }
}
@media (max-width: 700px) {
  .battle-layout { max-width: 505px; margin-inline: auto; grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .battle-panel { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding-top: 0; }
  .battle-preview { padding: 4px 7px; }
  .battle-preview-grid { width: 39px; }
  .battle-controls { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .battle-controls .action-tile:last-child { grid-column: auto; }
  .battle-keyboard { grid-column: 1 / -1; }
  .battle-field { padding: 6px; }
  .battle-fields { gap: 7px; }
  .battle-field-heading { padding-bottom: 6px; }
  .battle-pressure { font-size: 10px; }
}
@media (max-width: 350px) {
  .battle-pressure { display: grid; }
  .battle-panel .action-tile { font-size: 10px; }
}
