/* Classic Table uses the original 140 x 190 card artwork without cropping. */
:root {
  --card-width: 112px;
  --card-aspect: 140 / 190;
  --gap: 16px;
  --tableau-min-height: 300px;
  --felt-green: #285543;
  --table-chrome: #1d4335;
  --text-light: #f6f3e8;
  --text-muted: #c4d2c6;
  --card-shadow: 0 2px 5px #061e1840;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: auto; }
body { min-height: 100%; overflow-x: hidden; }
#game-shell { position: relative; height: 100vh; height: 100dvh; overflow: hidden; padding-top: env(safe-area-inset-top, 0px); }
#game-shell > .table-footer { position: absolute; }
.guide-link { color: var(--text-muted); text-underline-offset: 3px; }
.guide-link:hover { color: var(--text-light); }
.guide-link:focus-visible { outline: 2px solid #fff5ca; outline-offset: 4px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--felt-green);
  color: var(--text-light);
  font: 400 14px/1.4 system-ui, sans-serif;
}
.table-header {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  min-height: 84px;
  padding: 14px max(24px, calc((100vw - 1120px) / 2));
  background: var(--table-chrome);
}
.home-link { color: var(--text-muted); text-decoration: none; padding: 12px 4px; white-space: nowrap; }
.home-link:hover { color: var(--text-light); }
.table-brand { flex: 1; min-width: 0; }
.table-brand h1 { margin: 0; font: 400 28px/1.1 Georgia, serif; }
.table-brand > span { display: block; margin-top: 5px; color: var(--text-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.table-button {
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-light);
  font: 500 13px/1.3 system-ui, sans-serif;
  white-space: nowrap;
}
.table-button:hover { background: #ffffff0c; }
.table-button:disabled { opacity: .38; }
.primary-button { background: #fffdf3; color: #1d4335; }
.primary-button:hover { background: #efeddf; }
.table-button:focus-visible, .home-link:focus-visible { outline: 2px solid #fffdf3; outline-offset: 3px; }
.table-menu { overscroll-behavior: contain; --bs-dropdown-min-width: 14rem; --bs-dropdown-link-active-bg: #285543; max-height: min(440px, calc(100dvh - var(--header-h, 84px) - var(--footer-h, 108px) - env(safe-area-inset-top, 0px) - 12px)); overflow-y: auto; padding: 10px; border: 0; border-radius: 12px; background: #fffdf5; color: #243e32; box-shadow: 0 12px 40px #071f1950; }
.table-menu .dropdown-item { min-height: 42px; padding: 11px 12px; border-radius: 6px; font-size: 14px; }
.table-menu .dropdown-item:disabled { opacity: .45; }
.new-game-dropdown { position: static; }
#new-game-menu { right: max(12px, calc((100vw - 1120px) / 2)); left: auto; top: calc(100% - 4px); width: 290px; max-width: calc(100vw - 24px); }
#new-game-form h2 { margin: 4px 8px 12px; font: 400 21px/1.2 Georgia, serif; }
#new-game-form fieldset { padding: 6px 8px 10px; }
#new-game-form legend { float: none; width: auto; margin: 0; font-size: 12px; font-weight: 600; }
#new-game-form label { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; margin-right: 14px; }
#new-game-form input { accent-color: #285543; }
#new-game-form p { margin: 4px 8px 12px; font-size: 12px; color: #5a685e; }
#new-game-form .menu-primary { width: 100%; background: #285543; color: #fffdf3; }
main.container {
  max-width: 1080px;
  height: calc(100vh - var(--header-h, 84px) - var(--footer-h, 108px) - env(safe-area-inset-top, 0px));
  height: calc(100dvh - var(--header-h, 84px) - var(--footer-h, 108px) - env(safe-area-inset-top, 0px));
  padding: 0 24px;
  overflow: hidden;
}
.game-info { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 36px 24px; column-gap: 18px; align-content: start; height: 74px; padding-top: 12px; color: var(--text-muted); font-size: 12px; }
.deal-info { display: flex; gap: 10px; white-space: nowrap; color: var(--text-light); }
#game-status { min-width: 0; max-height: 36px; margin: 0; overflow-y: auto; line-height: 18px; scrollbar-width: thin; }
#save-warning { grid-column: 1 / -1; color: #ffedb7; font-size: 11px; line-height: 16px; }
#piles { position: relative; display: grid; grid-template-columns: repeat(7, var(--card-width)); grid-template-rows: auto auto; gap: var(--gap); padding: 8px 0; justify-content: center; touch-action: manipulation; }
#piles, #piles img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#piles img { -webkit-user-drag: none; }
#stock { grid-column: 1; grid-row: 1; }
#waste { grid-column: 2; grid-row: 1; background: transparent; }
#foundations { grid-column: 4 / span 4; grid-row: 1; display: flex; gap: var(--gap); }
#tableau { grid-column: 1 / span 7; grid-row: 2; display: flex; gap: var(--gap); }
.pile, .foundation, .column { position: relative; flex: 0 0 var(--card-width); width: var(--card-width); aspect-ratio: var(--card-aspect); border: 0; border-radius: 7px; overflow: visible; }
.pile, .foundation { background: #153d2e55; }
.column { min-height: var(--tableau-min-height); }
.column:empty::before { content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; aspect-ratio: var(--card-aspect); border-radius: 7px; background: #153d2e55; pointer-events: none; }
.foundation[data-suit-symbol]:empty::before { content: attr(data-suit-symbol); position: absolute; inset: 0; display: grid; place-items: center; font: 400 calc(var(--card-width) * .34)/1 Georgia, serif; color: #b9ccbc; opacity: .65; pointer-events: none; }
#stock:empty::before { content: '↻'; position: absolute; inset: 0; display: grid; place-items: center; color: #b9ccbc; font-size: calc(var(--card-width) * .36); }
.card { position: absolute; top: 0; left: 0; display: block; width: var(--card-width); height: auto; aspect-ratio: var(--card-aspect); border: 0; border-radius: 5px; background: transparent; user-select: none; touch-action: none; box-shadow: var(--card-shadow); transition: transform .16s ease, box-shadow .16s ease; cursor: grab; }
.card.face-down { pointer-events: none; }
@media (hover: hover) { .card.face-up:not(.selected-card):not(.dragging):hover { box-shadow: 0 4px 10px #061e1860; } }
.card.selected-card { transform: translateY(-6px); box-shadow: 0 0 0 2px #ffe2a4, 0 3px 5px #061e18c0, 0 12px 24px #061e18b3; }
.card.dragging { cursor: grabbing; transition: none !important; box-shadow: 0 0 0 2px #ffe2a4, 0 5px 8px #061e18d9, 0 18px 32px #061e18bf; z-index: 100 !important; }
.card:focus-visible, .pile:focus-visible, .foundation:focus-visible, .column:focus-visible { outline: 3px solid #fff5ca; outline-offset: 3px; }
.landing-preview { opacity: .72; position: absolute; z-index: 50; pointer-events: none; border-radius: 5px; background: #d6e6bc45; outline: 3px solid #ffe2a4; outline-offset: 0; box-shadow: 0 0 0 1px #173c2d, 0 7px 14px #061e18a6; }
.landing-preview[hidden] { display: none; }
.hint-highlight { outline: 3px solid #ffe2a4; outline-offset: 0; }
.card.animating, .card.dealing { pointer-events: none !important; will-change: transform, opacity; }
.card.card-land { animation: card-land .18s ease-out; }
.card.flip-pop { animation: flip-pop .24s ease-out; }
.pile.bounce, .foundation.bounce, .column.bounce { animation: pile-bounce .18s ease-out; }
.pile.shuffle-source { animation: shuffle-source .55s ease-in-out; }
@keyframes card-land { from { transform: translateY(-2px); } to { transform: translateY(0); } }
@keyframes flip-pop { 0% { transform: rotateY(0deg); } 55% { transform: rotateY(78deg); } 100% { transform: rotateY(0deg); } }
@keyframes pile-bounce { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-3px); } }
@keyframes shuffle-source { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.table-footer { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px)); color: var(--text-muted); background: var(--felt-green); }
.primary-actions { display: flex; gap: 8px; }
.primary-actions .table-button { min-width: 84px; background: #1d4838a8; }
.primary-actions .table-button:hover { background: #183d30; }
.primary-actions .table-button span { margin-right: 4px; }
.game-metrics { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; font-size: 12px; font-variant-numeric: tabular-nums; }
.game-metrics > span { white-space: nowrap; }
.modal { color: #243e32; }
.modal-content { background: #fffdf5; border: 0; border-radius: 14px; }
.modal-header, .modal-footer { border-color: #243e3218; }
.modal-title { font-family: Georgia, serif; font-size: 23px; }
.modal .btn-primary { --bs-btn-bg: #285543; --bs-btn-border-color: #285543; --bs-btn-hover-bg: #1d4335; --bs-btn-hover-border-color: #1d4335; --bs-btn-active-bg: #183d2e; --bs-btn-active-border-color: #183d2e; }
.deal-share-field { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; overflow-wrap: anywhere; resize: vertical; }
.statistics-mode { padding: .75rem; border: 1px solid #d8dfdc; border-radius: .4rem; }
.statistics-mode dl { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; margin: 0; }
.statistics-mode dt { font-weight: 400; }
.statistics-mode dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
#statistics-status:empty, #share-status:empty { display: none; }
.startup-message { position: absolute; z-index: 1100; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem; color: #fffdf3; background: #1d4335; text-align: center; }
.startup-message[hidden] { display: none; }
.startup-guide-link { color: #fffdf3; text-underline-offset: 3px; }
.startup-message button { padding: .65rem 1rem; border: 2px solid #fffdf3; border-radius: .4rem; color: #fffdf3; background: #1d4335; cursor: pointer; }
.game-unavailable #piles { visibility: hidden; }
.no-script-message { position: absolute; z-index: 1200; inset: 0; padding: 2rem; color: #fffdf3; background: #1d4335; }
.no-script-message a { color: #fffdf3; }
@media (max-width: 600px) {
  .table-header { min-height: 74px; padding: 10px 12px; gap: 5px; }
  .home-link { font-size: 13px; padding-right: 7px; }
  .table-brand h1 { font-size: 23px; }
  .table-brand > span { font-size: 9px; }
  .table-button { padding: 11px 12px; }
  main.container { padding: 0 10px; }
  .game-info { grid-template-columns: 1fr; grid-template-rows: 20px 36px 30px; gap: 0; height: 100px; padding-top: 10px; font-size: 11px; }
  .deal-info { gap: 10px; }
  #game-status { grid-row: 2; }
  #save-warning { grid-row: 3; font-size: 10px; }
  .table-footer { gap: 12px; padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .primary-actions { width: min(100%, 360px); gap: 6px; }
  .primary-actions .table-button { flex: 1; }
  .game-metrics { gap: 6px 12px; font-size: 10px; }
}
@media (max-width: 360px) {
  .home-link span { display: none; }
  .home-link { font-size: 24px; min-width: 24px; padding: 6px 2px; text-align: center; }
  .table-brand h1 { font-size: 21px; }
  .table-button { padding-right: 10px; padding-left: 10px; }
  main.container { padding: 0 6px; }
}
@media (max-height: 450px) {
  .table-header { min-height: 54px; padding-top: 4px; padding-bottom: 4px; }
  .table-brand h1 { font-size: 22px; }
  .table-brand > span { display: none; }
  .game-info { height: 46px; grid-template-columns: auto 1fr; grid-template-rows: 32px; padding-top: 6px; font-size: 10px; }
  .deal-info { display: block; }
  .deal-info > span { display: block; }
  #game-status { grid-column: 2; grid-row: 1; max-height: 32px; line-height: 16px; }
  #save-warning { position: fixed; bottom: 66px; left: 8px; z-index: 200; background: var(--table-chrome); }
  .table-footer { flex-direction: row; justify-content: center; gap: 16px; padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); }
  .primary-actions { width: auto; }
  .primary-actions .table-button { min-width: 64px; padding: 10px; }
  .game-metrics { gap: 3px 12px; max-width: 260px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .pile, .foundation, .column { transition: none !important; animation: none !important; }
}

/* Searchable rules and direct answers live outside the full-height game table. */
.solitaire-guide { background: #fffdf5; color: #243e32; padding: 48px 24px 64px; scroll-margin-top: 0; }
.guide-inner { max-width: 840px; margin: 0 auto; }
.solitaire-guide nav { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 0 0 32px; }
.solitaire-guide a { color: #245e48; text-underline-offset: 3px; }
.solitaire-guide a:focus-visible { outline: 3px solid #285543; outline-offset: 4px; }
.guide-eyebrow { color: #5a6b5f; font-size: 12px; letter-spacing: .06em; }
.solitaire-guide h2 { font: 400 clamp(30px, 5vw, 42px)/1.15 Georgia, serif; margin: 12px 0 20px; }
.guide-intro { font-size: 18px; line-height: 1.65; }
.solitaire-guide h3 { font: 400 27px/1.25 Georgia, serif; margin: 38px 0 18px; }
.solitaire-guide h4 { font: 600 17px/1.4 system-ui, sans-serif; margin: 0 0 10px; }
.solitaire-guide p, .solitaire-guide li { line-height: 1.75; }
.solitaire-guide li { padding-left: 4px; margin-bottom: 12px; }
.guide-answer { margin-top: 26px; }
.solitaire-guide .guide-related { margin: 40px 0 0; padding-top: 24px; border-top: 1px solid #243e3225; }
@media(max-width: 600px) {
  .solitaire-guide { padding: 32px 20px 48px; }
  .guide-intro { font-size: 16px; }
  .solitaire-guide nav a { padding: 8px 0; }
}

/* Shared advertising and recommendations stay below the rules, outside play. */
.solitaire-discovery { display: flow-root; padding: 0 0 32px; background: #fffdf5; }
