/* Hangman Game - Modern Stylesheet */

:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #273549;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;

  --accent: #f59e0b;
  --accent-hover: #d97706;
  --danger: #ef4444;
  --success: #10b981;

  --gallows-stroke: #f8fafc;
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
}

.back-link:hover, .back-link:focus-visible {
  color: var(--accent);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-icon {
  font-size: 1.5rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-main);
}

.icon-button {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-button:hover, .icon-button:focus-visible {
  background: var(--border);
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Main Container */
.game-container {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-header-text {
  text-align: center;
  margin-bottom: 1rem;
}

.game-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.game-subtitle {
  color: var(--text-muted);
  font-size: 0.925rem;
  max-width: 540px;
  margin: 0 auto;
}

/* Category Filter Bar */
.category-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.cat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s ease;
}

.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f172a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* Game Cabinet */
.hangman-cabinet {
  background-color: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* HUD */
.cabinet-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hud-label {
  color: var(--text-muted);
}

.lives-indicators {
  display: flex;
  gap: 4px;
}

.life-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--border);
  transition: background-color 0.2s ease;
}

.life-dot.active {
  background-color: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* Gallows SVG */
.gallows-wrapper {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 320px;
}

.gallows-svg {
  width: 160px;
  height: 190px;
}

.gallows-wood {
  stroke: #78350f;
  stroke-width: 6;
  stroke-linecap: round;
}

.gallows-rope {
  stroke: #d97706;
  stroke-width: 3;
  stroke-dasharray: 2, 2;
}

.figure-part {
  stroke: #f8fafc;
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
  transition: opacity 0.3s ease;
}

/* Secret Word Slots */
.word-slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.25rem;
  min-height: 54px;
}

.slot {
  width: 38px;
  height: 48px;
  border-bottom: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.slot.revealed {
  animation: slot-pop 0.2s ease;
}

@keyframes slot-pop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Hint Bar */
.hint-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.action-hint-btn {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.action-hint-btn:hover:not(:disabled) {
  background: var(--border);
}

.action-hint-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint-display {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-style: italic;
}

/* Letter Keyboard */
.letter-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
}

.char-btn {
  width: 40px;
  height: 44px;
  background-color: #334155;
  color: #ffffff;
  border: 1px solid #475569;
  border-radius: 6px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.char-btn:hover:not(:disabled) {
  background-color: var(--accent);
  color: #0f172a;
}

.char-btn:disabled {
  background-color: #1e293b;
  border-color: #334155;
  color: #475569;
  cursor: not-allowed;
  transform: none !important;
}

.char-btn.correct {
  background-color: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

.char-btn.wrong {
  background-color: #7f1d1d !important;
  border-color: var(--danger) !important;
  color: #fca5a5 !important;
}

/* Outcome Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-badge {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.solution-reveal {
  background: #0b1120;
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sol-tag {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sol-text {
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 2px;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
}

.stat-lbl {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.stat-val {
  color: #ffffff;
  font-size: 1.25rem;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0f172a;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* SEO Content */
.content-block {
  max-width: 680px;
  width: 100%;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.freshness-tag {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-section {
  margin-bottom: 2rem;
}

.article-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.85rem;
}

.article-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 1.25rem 0 0.6rem;
}

.article-section p {
  color: #cbd5e1;
  margin-bottom: 1rem;
  line-height: 1.7;
}

.rules-list {
  padding-left: 1.25rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rules-list strong {
  color: #ffffff;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.strategy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.strategy-card h4 {
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.strategy-card p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.6;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.faq-item[open] {
  border-color: var(--accent);
}

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent);
}

.faq-item[open] .faq-question::after {
  content: "−";
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: #cbd5e1;
  font-size: 0.925rem;
  line-height: 1.6;
}

.cross-links {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.related-games-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.related-games-list li a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.related-games-list li a:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}
