/* This page was created with the help of Claude Fable 5 by Anthropic. */
/* spider.css — Spider Solitaire (legacy design, code-cleanup pass).
   Extracted as-is from the original single-file version; visual design
   unification with the rest of the site is planned as a separate step.
   The game board itself is drawn on <canvas> by js/spider.js. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a; --panel: #161616; --text: #e8e8e8; --muted: #888; --accent: #c8a84e;
  --canvas-bg: #0a0a0a; --overlay-bg: rgba(0, 0, 0, 0.6);
  --menu-bg: rgba(20, 20, 20, 0.96); --menu-border: rgba(255, 255, 255, 0.1);
  --btn-bg: #252525; --btn-hover: #353535;
  --slot-stroke: rgba(255, 255, 255, 0.15);
}

body.theme-classic {
  --bg: #16643c; --panel: #0a4128; --canvas-bg: #16643c;
  --overlay-bg: rgba(0, 0, 0, 0.3); --menu-bg: rgba(10, 65, 40, 0.96);
  --menu-border: rgba(255, 255, 255, 0.18);
  --btn-bg: rgba(255, 255, 255, 0.13); --btn-hover: rgba(255, 255, 255, 0.22);
  --slot-stroke: rgba(255, 255, 255, 0.5);
  --deal-card-bg: #1a5a3e;
}

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  font-weight: 500;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  max-width: 100vw;
}

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 100vw;
  overflow: hidden;
}

/* --- Top bar --- */
#topbar {
  background: var(--panel); padding: 6px 10px; display: flex;
  align-items: center; justify-content: space-between; gap: 6px;
  z-index: 10; min-height: 44px; max-width: 100vw;
}
#status {
  font-size: 18px; color: var(--muted); letter-spacing: 0.5px; white-space: nowrap;
  position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
}

.icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: var(--btn-bg); color: var(--text); cursor: pointer;
  display: grid; place-items: center; transition: background .2s;
  touch-action: manipulation; flex-shrink: 0;
}
.icon-btn:hover { background: var(--btn-hover); }
.icon-btn[disabled] { opacity: 0.3; pointer-events: none; }
.icon-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#main { position: relative; height: 100%; overflow: hidden; }
canvas { width: 100%; height: 100%; display: block; }

/* --- Bottom bar --- */
#bottombar {
  background: var(--panel); padding: 6px 10px; display: flex;
  align-items: center; justify-content: space-between; gap: 6px;
  z-index: 10; min-height: 44px; max-width: 100vw; position: relative;
}
.bb-left { display: flex; align-items: center; gap: 8px; }
.bb-right { display: flex; align-items: center; gap: 6px; }
#stockWarning { font-size: 13px; color: var(--accent); display: none; }

#dealBtn {
  position: relative; width: 46px; height: 38px; border: none; background: none; cursor: pointer;
  touch-action: manipulation; display: flex; align-items: center; justify-content: flex-start;
}
.deal-card {
  position: absolute; width: 22px; height: 30px; border-radius: 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: var(--deal-card-bg, var(--btn-bg));
  pointer-events: none;
}
#dealBtn:hover .deal-card { border-color: rgba(255, 255, 255, 0.8); }

/* --- Overlays (instructions / difficulty / seed / win) --- */
.overlay {
  position: absolute; inset: 0; display: none; place-items: center;
  background: var(--overlay-bg); backdrop-filter: blur(2px); z-index: 100;
}
.overlay.active { display: grid; }
.overlay-card {
  width: min(440px, 92vw); max-height: calc(100% - 20px); overflow-y: auto;
  background: var(--menu-bg); border: 1px solid var(--menu-border);
  border-radius: 16px; padding: 28px 24px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.overlay-card h2 { font-size: 24px; font-weight: 600; letter-spacing: 0.5px; text-align: center; margin-bottom: 14px; }
.overlay-card p { color: var(--muted); font-size: 15px; text-align: center; margin-bottom: 14px; line-height: 1.6; }
.btn-row { display: grid; gap: 8px; }
.btn-row.horizontal { display: flex; gap: 10px; justify-content: center; }
.level-btn {
  font: inherit; font-weight: 600; font-size: 15px; letter-spacing: 0.3px;
  padding: 14px 20px; border: none; border-radius: 999px;
  background: var(--btn-bg); color: var(--text); cursor: pointer;
  touch-action: manipulation; transition: background .25s; text-align: left;
}
.level-btn:hover { background: var(--btn-hover); }
.action-btn {
  font: inherit; font-weight: 600; font-size: 15px; padding: 11px 24px;
  border-radius: 999px; border: none; background: var(--btn-bg); color: var(--text);
  cursor: pointer; transition: background .25s;
}
.action-btn:hover { background: var(--btn-hover); }
.action-btn.accent { color: var(--accent); }

/* --- Confirm dialog --- */
.confirm-overlay {
  position: absolute; inset: 0; display: none; place-items: center;
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); z-index: 200;
}
.confirm-overlay.active { display: grid; }
.confirm-card {
  width: min(360px, 85vw); background: var(--menu-bg);
  border: 1px solid var(--menu-border); border-radius: 14px; padding: 24px; text-align: center;
}
.confirm-card p { color: var(--text); font-size: 15px; margin-bottom: 18px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }

/* --- Instructions content --- */
.instructions-section { margin-bottom: 16px; text-align: left; }
.instructions-section h3 { font-size: 14px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.instructions-section table { width: 100%; font-size: 14px; border-collapse: collapse; }
.instructions-section td { padding: 5px 8px; color: var(--text); vertical-align: top; }
.instructions-section td:first-child { color: var(--muted); white-space: nowrap; width: 35%; }
.instructions-section p.desc { font-size: 14px; color: var(--text); text-align: left; line-height: 1.6; margin-bottom: 4px; }
.btn-guide { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.btn-guide-item { display: flex; align-items: center; gap: 8px; min-width: calc(50% - 8px); }
.btn-guide-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--btn-bg); display: grid; place-items: center; flex-shrink: 0; }
.btn-guide-icon.guide-stepper { font-size: 7px; line-height: 1; color: var(--text); }
.btn-guide-icon.guide-stepper .guide-stepper-value { font-size: 11px; font-weight: 700; }
.btn-guide-icon svg { width: 15px; height: 15px; stroke: var(--text); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-guide-icon .filled { fill: var(--text); stroke: none; }
.btn-guide-icon.text-icon { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1; }
.btn-guide-label { font-size: 13px; color: var(--text); }
.btn-guide-sub { font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.btn-guide-deal { display: flex; gap: 2px; align-items: center; }
.btn-guide-deal span { width: 10px; height: 14px; border-radius: 2px; border: 1px solid rgba(255, 255, 255, 0.45); background: var(--btn-bg); }
@media (max-width: 400px) { .btn-guide-item { min-width: 100%; } }

/* --- Seed dialog --- */
.seed-input {
  width: 150px; font: inherit; font-size: 16px; font-weight: 500; padding: 10px 14px;
  border: 1px solid var(--menu-border); background: var(--btn-bg);
  color: var(--text); text-align: center; outline: none;
}
.seed-input:focus { border-color: var(--accent); }
.seed-display { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* --- Language toggle inside instructions --- */

/* --- Responsive tweaks --- */
@media (pointer: coarse) and (hover: none) { .kb-only { display: none; } }

@media (max-width: 600px) {
  .kb-only { display: none; }
  #topbar, #bottombar { padding: 4px 6px; gap: 4px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 18px; height: 18px; }
  #status { font-size: clamp(11px, 3.5vw, 16px); }
  .overlay-card { padding: 20px 16px; }
  .overlay-card h2 { font-size: 20px; }
  .level-btn { font-size: 14px; padding: 12px 14px; }
  .instructions-section table { font-size: 13px; }
  #dealBtn { width: 40px; height: 32px; }
  .deal-card { width: 18px; height: 24px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  #topbar, #bottombar { padding: 3px 8px; min-height: 34px; }
  .icon-btn { width: 30px; height: 30px; }
  .icon-btn svg { width: 16px; height: 16px; }
  #status { font-size: 13px; }
  .overlay-card { padding: 14px; max-height: calc(100% - 10px); }
  .overlay-card h2 { font-size: 17px; margin-bottom: 8px; }
  .level-btn { font-size: 13px; padding: 9px 11px; }
}

@media (min-width: 900px) {
  #topbar, #bottombar { padding: 8px 18px; min-height: 52px; }
  .bb-right { gap: 10px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn svg { width: 26px; height: 26px; }
  #status { font-size: 20px; }
  #dealBtn { width: 56px; height: 44px; }
  .deal-card { width: 26px; height: 34px; }
  #stockWarning { font-size: 14px; }
}
