/* HoldemIQ — styles */

:root {
  --color-bg: #0b1f1a;
  --color-table: #0d3b30;
  --color-table-light: #14513f;
  --color-accent: #f2c14e;
  --color-accent-dark: #d69c2f;
  --color-text: #f7f0dd;
  --color-text-muted: #b9c9c2;
  --color-card-bg: #ffffff;
  --color-card-text: #111;
  --color-red: #c0392b;
  --color-black: #1a1a1a;
  --color-danger: #c0392b;
  --color-success: #2e8b57;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: linear-gradient(180deg, #0d2b23, #0b1f1a);
  border-bottom: 2px solid var(--color-accent-dark);
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
  color: var(--color-text);
}

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

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-table-light);
  color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-accent-dark);
  color: var(--color-accent);
}

.btn-primary {
  background: var(--color-accent);
  color: #14231d;
}

.btn-fold { background: #5a1f1f; }
.btn-check { background: #2f4f4f; }
.btn-call { background: #1f5a4a; }
.btn-raise { background: var(--color-accent); color: #14231d; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 1.2rem;
  cursor: pointer;
}

/* ---------- Poker table ---------- */

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 20px;
}

.poker-table {
  width: min(900px, 100%);
  background: radial-gradient(ellipse at center, var(--color-table-light) 0%, var(--color-table) 70%);
  border: 10px solid #3b2a1a;
  border-radius: 160px / 90px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.95rem;
}

.player-name {
  font-weight: 700;
}

.player-stack {
  color: var(--color-accent);
  font-weight: 600;
}

.player-bet {
  color: var(--color-text-muted);
  font-style: italic;
  min-height: 1.1em;
}

.dealer-badge {
  background: var(--color-accent);
  color: #14231d;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.hand-cards, .board-cards {
  display: flex;
  gap: 8px;
  justify-content: center;
  min-height: 90px;
}

.table-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  width: 100%;
}

.phase-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pot-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
}

.table-message {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  background: #14231d;
  border: 1px solid var(--color-accent-dark);
  color: var(--color-text);
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  z-index: 5;
}

.table-message.visible {
  opacity: 1;
}

.table-message.win { border-color: var(--color-success); color: #b9f6ca; }
.table-message.lose { border-color: var(--color-danger); color: #ffcdd2; }
.table-message.tie { border-color: var(--color-accent); }

/* ---------- Cards ---------- */

.card {
  width: 58px;
  height: 84px;
  background: var(--color-card-bg);
  color: var(--color-card-text);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  flex-shrink: 0;
  animation: dealIn 0.25s ease;
}

.card-mini {
  width: 40px;
  height: 58px;
  font-size: 0.75rem;
}

@keyframes dealIn {
  from { transform: translateY(-20px) scale(0.8); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.card-rank {
  font-size: 1.1rem;
  line-height: 1;
}

.card-mini .card-rank { font-size: 0.85rem; }

.card-suit {
  font-size: 1.3rem;
  line-height: 1;
}

.card-mini .card-suit { font-size: 1rem; }

.suit-red { color: var(--color-red); }
.suit-black { color: var(--color-black); }

.card-back {
  background: repeating-linear-gradient(45deg, #14513f, #14513f 6px, #0d3b30 6px, #0d3b30 12px);
  border: 2px solid var(--color-accent-dark);
}

.card-empty {
  background: transparent;
  border: 2px dashed rgba(247, 240, 221, 0.2);
  box-shadow: none;
}

/* ---------- Action bar ---------- */

.action-bar {
  width: min(900px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0d2b23;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.raise-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.raise-control label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.raise-control input[type="range"] {
  width: min(400px, 90%);
  accent-color: var(--color-accent);
}

/* ---------- Log ---------- */

.log-panel {
  width: min(900px, 100%);
  background: #0d2b23;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.log-panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--color-accent);
}

.hand-log {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  font-size: 0.85rem;
}

.log-entry {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(247, 240, 221, 0.08);
  color: var(--color-text-muted);
}

/* ---------- Tutorial modal ---------- */

.tutorial-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.tutorial-modal.visible {
  display: flex;
}

.tutorial-dialog {
  background: #0d2b23;
  border: 1px solid var(--color-accent-dark);
  border-radius: var(--radius);
  width: min(700px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(247, 240, 221, 0.1);
}

.tutorial-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--color-accent);
}

.tutorial-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.tutorial-body h3 {
  margin-top: 0;
  color: var(--color-accent);
}

.tutorial-body p {
  line-height: 1.5;
  color: var(--color-text);
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid rgba(247, 240, 221, 0.1);
  flex-wrap: wrap;
  gap: 10px;
}

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

.tutorial-nav {
  display: flex;
  gap: 10px;
}

.tutorial-visual {
  margin-top: 16px;
}

.tutorial-demo {
  height: 70px;
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, #14513f, #14513f 10px, #0d3b30 10px, #0d3b30 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* ---------- Ranking list (tutorial) ---------- */

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 160px auto 1fr;
  align-items: center;
  gap: 10px;
  background: rgba(247, 240, 221, 0.04);
  border-radius: 8px;
  padding: 8px 10px;
}

.ranking-label {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 0.85rem;
}

.ranking-cards {
  display: flex;
  gap: 4px;
}

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

/* ---------- Quiz ---------- */

.quiz-question {
  margin-bottom: 18px;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.quiz-choice {
  text-align: left;
  background: rgba(247, 240, 221, 0.06);
  border: 1px solid rgba(247, 240, 221, 0.15);
  color: var(--color-text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.quiz-choice:hover:not(:disabled) {
  background: rgba(247, 240, 221, 0.12);
}

.quiz-choice:disabled {
  cursor: default;
}

.quiz-correct {
  border-color: var(--color-success);
  background: rgba(46, 139, 87, 0.25);
}

.quiz-wrong {
  border-color: var(--color-danger);
  background: rgba(192, 57, 43, 0.25);
}

.quiz-footer {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 10px;
}

/* ---------- Footer ---------- */

.app-footer {
  text-align: center;
  padding: 16px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(247, 240, 221, 0.1);
}

.app-footer p {
  margin: 0;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  :root { font-size: 15px; }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .poker-table {
    border-radius: 40px;
    padding: 20px 10px;
  }

  .card {
    width: 46px;
    height: 68px;
  }

  .card-rank { font-size: 0.9rem; }
  .card-suit { font-size: 1rem; }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons .btn {
    width: 100%;
  }

  .ranking-row {
    grid-template-columns: 1fr;
  }
}
