/* Imperial Biryani Challenge — Mughal-inspired UI */
:root {
  --parchment: #f4e7cc;
  --parchment-dark: #e6d3ab;
  --ink: #2a1a0a;
  --crimson: #8b1a1a;
  --crimson-dark: #5e0f0f;
  --saffron: #d97706;
  --saffron-light: #f4b731;
  --gold: #b8860b;
  --emerald: #0f5132;
  --emerald-dark: #082e1b;
  --sky: #2d5f7d;
  --cream: #fdf6e3;
  --shadow: 0 4px 12px rgba(60, 30, 10, 0.25);
  --shadow-lg: 0 10px 30px rgba(60, 30, 10, 0.35);
  --border-dark: #7c4a1c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Georgia", "Book Antiqua", serif;
  background:
    radial-gradient(ellipse at top left, rgba(217, 119, 6, 0.15), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(139, 26, 26, 0.25), transparent 60%),
    linear-gradient(135deg, #1a0f0a 0%, #2d1810 50%, #1a0f0a 100%);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0.02em; }
.hidden { display: none !important; }

/* ==== SCREEN SYSTEM ==== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ==== PARCHMENT CARD ==== */
.parchment {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.4), transparent 40%),
    linear-gradient(135deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  border: 3px double var(--border-dark);
  border-radius: 12px;
  box-shadow: var(--shadow-lg), inset 0 0 40px rgba(120, 70, 20, 0.15);
  position: relative;
}
.parchment::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(124, 74, 28, 0.4);
  border-radius: 8px;
  pointer-events: none;
}

/* ==== SETUP SCREEN ==== */
#setup { align-items: center; justify-content: center; padding: 2rem; }
.setup-card { max-width: 640px; width: 100%; padding: 2.5rem; text-align: center; }
.crest { font-size: 3rem; color: var(--crimson); margin-bottom: 0.5rem; }
.title {
  font-size: 2.6rem;
  color: var(--crimson);
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.subtitle {
  color: var(--saffron);
  font-style: italic;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.setup-row { margin: 1.25rem 0; text-align: left; }
.setup-label {
  display: block;
  font-weight: 700;
  color: var(--emerald-dark);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
.pill-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  background: var(--cream);
  border: 2px solid var(--border-dark);
  color: var(--ink);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  transition: all 0.15s;
  font-size: 0.95rem;
}
.pill:hover { background: var(--parchment-dark); }
.pill.active {
  background: var(--crimson);
  color: var(--cream);
  border-color: var(--crimson-dark);
  box-shadow: 0 2px 6px rgba(139,26,26,0.5);
}
.pill .hint { font-size: 0.75rem; opacity: 0.75; margin-left: 0.25rem; }
.mode-explain {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--emerald-dark);
  font-style: italic;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.4);
  border-left: 3px solid var(--saffron);
  border-radius: 4px;
}

.players-config { display: flex; flex-direction: column; gap: 0.5rem; }
.player-config-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255,255,255,0.35);
  border-radius: 8px;
}
.color-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink); }
.player-config-row input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  background: var(--cream);
  font-family: inherit;
  font-size: 0.95rem;
}
.player-config-row select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  background: var(--cream);
  font-family: inherit;
}

.setup-actions { margin-top: 1.5rem; text-align: center; }
.btn-primary {
  background: linear-gradient(135deg, var(--saffron) 0%, var(--gold) 100%);
  color: var(--cream);
  border: 2px solid var(--saffron-light);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(217, 119, 6, 0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5); }

.btn-small {
  background: var(--cream);
  border: 1px solid var(--border-dark);
  color: var(--ink);
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.1s;
}
.btn-small:hover:not(:disabled) { background: var(--saffron-light); }
.btn-small:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-small.primary { background: var(--emerald); color: var(--cream); border-color: var(--emerald-dark); }
.btn-small.primary:hover:not(:disabled) { background: var(--emerald-dark); }
.btn-small.danger { background: var(--crimson); color: var(--cream); border-color: var(--crimson-dark); }
.btn-small.warn { background: #7a5b1a; color: var(--cream); border-color: var(--saffron); }
.btn-small.warn:hover:not(:disabled) { background: var(--saffron); color: var(--ink); }

/* ==== SELECTION TRAY ==== */
.selection-tray {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.18), rgba(217, 119, 6, 0.08));
  border: 2px dashed var(--saffron);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin: 0.5rem 0;
  color: var(--cream);
}
.tray-header {
  font-size: 0.75rem;
  color: var(--saffron-light);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.tray-icons { display: flex; flex-wrap: wrap; gap: 0.3rem; min-height: 1.5rem; align-items: center; }
.tray-empty { opacity: 0.6; font-size: 0.78rem; }
.tray-tag {
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.2);
}
.tray-flourish {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dotted rgba(255,255,255,0.15);
  font-size: 0.78rem;
  color: #d0b0f0;
}
.warn-badge {
  display: inline-block;
  background: var(--crimson);
  color: var(--cream);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 0.35rem;
}

/* ==== COOK BUTTONS ==== */
.cook-btn-row { margin: 0.2rem 0; }
.cook-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--emerald) 0%, #0a4426 100%);
  color: var(--cream);
  border: 1px solid var(--saffron-light);
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  display: block;
}
.cook-btn:hover:not(.disabled) {
  background: linear-gradient(135deg, #0a4426 0%, var(--emerald) 100%);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 81, 50, 0.4);
}
.cook-btn.disabled {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.4);
  cursor: not-allowed;
}
.cook-btn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}
.cook-label { font-size: 0.88rem; }
.cook-ap {
  background: var(--saffron);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
}
.cook-status {
  display: block;
  font-size: 0.72rem;
  font-style: italic;
  margin-top: 0.15rem;
}
.cook-status.miss { color: #ff9c9c; font-style: normal; }
.cook-status.warn { color: var(--saffron-light); font-weight: 700; }
.cook-status.ok { color: #a8f0a8; font-weight: 700; }

/* ==== SCHEDULE MODAL ==== */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 1rem 0;
}
.schedule-day {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
}
.schedule-day.past { opacity: 0.55; background: rgba(0,0,0,0.05); }
.schedule-day.current {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.35), rgba(244, 183, 49, 0.5));
  border-color: var(--saffron);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}
.sched-day-n {
  font-weight: 800;
  color: var(--crimson-dark);
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px dotted rgba(0,0,0,0.2);
  padding-bottom: 0.2rem;
}
.sched-guest { font-weight: 700; font-size: 0.85rem; margin-top: 0.2rem; }
.sched-guest-sub { font-weight: 400; font-size: 0.75rem; opacity: 0.75; }
.sched-note { font-size: 0.72rem; color: var(--emerald-dark); margin-top: 0.15rem; font-style: italic; }
.sched-note-em { font-size: 0.78rem; opacity: 0.6; font-style: italic; }
.sched-event { font-size: 0.78rem; color: var(--crimson); font-weight: 700; margin-top: 0.2rem; }
.phase-list { margin: 0.5rem 0 0 1.5rem; }
.phase-list li { margin-bottom: 0.35rem; line-height: 1.5; }

.footer-note { margin-top: 1.5rem; font-style: italic; color: var(--emerald-dark); }

/* ==== GAME SCREEN ==== */
.game-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(180deg, var(--crimson-dark), var(--crimson));
  border-bottom: 3px double var(--saffron-light);
  color: var(--cream);
  gap: 1rem;
}
.header-left, .header-right { display: flex; gap: 0.5rem; align-items: center; }
.header-right { justify-content: flex-end; }
.day-badge {
  background: var(--saffron);
  color: var(--ink);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}
.phase-badge {
  background: var(--emerald);
  color: var(--cream);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}
.game-title {
  font-size: 1.3rem;
  color: var(--saffron-light);
  text-align: center;
  letter-spacing: 0.1em;
  font-family: "Palatino Linotype", serif;
}

.phase-strip {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.75rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.3));
  border-bottom: 1px solid rgba(217, 119, 6, 0.3);
  overflow-x: auto;
}
.strip-step {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  color: var(--parchment);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
  cursor: help;
}
.strip-step .strip-n {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: var(--cream);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem;
}
.strip-step.done { opacity: 0.5; }
.strip-step.done .strip-n { background: var(--emerald); }
.strip-step.current {
  background: var(--saffron);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}
.strip-step.current .strip-n { background: var(--ink); color: var(--saffron-light); }
.strip-sep { color: rgba(255,255,255,0.3); font-size: 0.9rem; padding: 0 2px; }

.game-body {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 0.75rem;
  padding: 0.75rem;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  overflow-y: auto;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--cream);
}
.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--saffron-light);
  border-bottom: 1px solid rgba(217, 119, 6, 0.4);
  padding-bottom: 0.25rem;
  margin: 0.75rem 0 0.5rem 0;
}
.sidebar-title:first-child { margin-top: 0; }
.hand-count { float: right; color: var(--parchment); font-size: 0.85rem; font-weight: 400; }

.main-board {
  overflow-y: auto;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 8px;
  padding: 1rem;
}
.board-section { margin-bottom: 1.25rem; }
.section-heading {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--saffron-light);
  border-bottom: 1px solid rgba(217, 119, 6, 0.4);
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
}

/* ==== PLAYERS PANEL ==== */
.player-tile {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 4px solid var(--player-color, var(--saffron));
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.4rem;
}
.player-tile.active { background: rgba(217, 119, 6, 0.18); border-color: rgba(217,119,6,0.6); }
.player-tile-header { display: flex; justify-content: space-between; align-items: center; }
.player-tile-name { font-weight: 700; font-size: 0.95rem; }
.player-tile-name .robot { font-size: 0.85rem; margin-left: 0.25rem; }
.player-tile-stats { display: flex; gap: 0.6rem; font-size: 0.78rem; margin-top: 0.3rem; flex-wrap: wrap; }
.stat-ap { color: var(--saffron-light); font-weight: 800; font-size: 1.05rem; }
.stat-ap small { font-size: 0.65rem; font-weight: 600; opacity: 0.85; }
.stat-scrutiny { color: #ff9c9c; font-weight: 600; }
.stat-hand { color: #c8d8ff; font-weight: 500; }
.player-tile-cooked { font-size: 0.72rem; opacity: 0.75; margin-top: 0.25rem; line-height: 1.3; }

.turn-order { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.turn-chip {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--cream);
  background: rgba(255,255,255,0.08);
  border-left: 3px solid var(--player-color);
}
.turn-chip.done { opacity: 0.4; text-decoration: line-through; }
.turn-chip.current { background: var(--saffron); color: var(--ink); font-weight: 700; }

/* ==== MARKETS ==== */
.markets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.market {
  background: linear-gradient(180deg, rgba(244, 231, 204, 0.95), rgba(230, 211, 171, 0.9));
  border: 2px solid var(--border-dark);
  border-radius: 10px;
  padding: 0.7rem;
  position: relative;
  box-shadow: 0 2px 8px rgba(60, 30, 10, 0.2);
}
.market.closed { background: rgba(180, 180, 180, 0.5); }
.market-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--crimson-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}
.market-icon { font-size: 1.3rem; }
.market-name { flex: 1; }
.market-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.market-badge.warn { background: var(--saffron); color: var(--ink); }
.market-badge.danger { background: var(--crimson); color: var(--cream); }
.market-caption {
  font-size: 0.72rem;
  color: var(--emerald-dark);
  font-style: italic;
  margin-bottom: 0.25rem;
  line-height: 1.15;
}
.market-meta {
  font-size: 0.68rem;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 0.4rem;
  border-bottom: 1px dotted rgba(0,0,0,0.15);
  padding-bottom: 0.25rem;
}
.market-cards { display: flex; flex-direction: column; gap: 0.4rem; min-height: 60px; }
.empty-slot {
  color: var(--ink);
  opacity: 0.4;
  text-align: center;
  font-style: italic;
  font-size: 0.75rem;
  padding: 0.5rem;
  border: 1px dashed var(--border-dark);
  border-radius: 6px;
}

.card {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.55), transparent 40%),
    linear-gradient(135deg, var(--cream) 0%, #efe1c1 100%);
  border: 2px solid var(--border-dark);
  border-radius: 10px;
  padding: 0.5rem;
  min-height: 60px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -1px 0 rgba(0,0,0,0.08);
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.card::before {
  content: '';
  position: absolute; inset: 3px;
  border: 1px dashed rgba(124, 74, 28, 0.3);
  border-radius: 7px;
  pointer-events: none;
}
.card:hover:not(.disabled) {
  transform: translateY(-3px) rotate(-0.5deg);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  border-color: var(--saffron);
}
.card.disabled { opacity: 0.5; cursor: not-allowed; }
.card.selected {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald), 0 4px 10px rgba(15, 81, 50, 0.4);
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.55), transparent 40%),
    linear-gradient(135deg, #dcefdc 0%, #b5dcb5 100%);
  transform: translateY(-2px);
}
.card.selected::after {
  content: '✓';
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  background: var(--emerald);
  color: var(--cream);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(15, 81, 50, 0.5);
  border: 2px solid var(--cream);
}
.card.flourish-sel {
  border-color: #6a3fa0;
  box-shadow: 0 0 0 3px #6a3fa0, 0 4px 10px rgba(106, 63, 160, 0.4);
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.55), transparent 40%),
    linear-gradient(135deg, #efe4ff 0%, #c8b0ec 100%);
}
.card.flourish-sel::after {
  content: '✨';
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  background: #6a3fa0;
  color: var(--cream);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(106, 63, 160, 0.5);
  border: 2px solid var(--cream);
}
.card.combo {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.5), transparent 40%),
    linear-gradient(135deg, #fdead3 0%, #f4c988 100%);
}
.card.joker {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.5), transparent 40%),
    linear-gradient(135deg, #e8d4ff 0%, #c8a8f0 100%);
  border-color: #6a3fa0;
}
.card.unique { background: linear-gradient(135deg, #fff2b3, #f4d264); border-color: var(--gold); }
.card.card-sm { min-height: 40px; padding: 0.25rem 0.4rem; font-size: 0.72rem; }

.card-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}
.card {
  justify-content: center;
  min-height: 54px;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0,0,0,0.08);
  color: var(--ink);
  border: 1px solid rgba(0,0,0,0.15);
  gap: 0.25rem;
  line-height: 1;
}
.icon-pill .ipg { font-size: 0.95rem; line-height: 1; filter: drop-shadow(0 1px 0 rgba(255,255,255,0.4)); }
.icon-pill .ipl { font-size: 0.7rem; }
.icon-spice { background: #ffe0b3; color: #7a4a10; border-color: #b98832; }
.icon-paste { background: #d3c4a0; color: #4a3810; border-color: #7a6b40; }
.icon-curd  { background: #f4f4dc; color: #5a5a20; border-color: #a4a48c; }
.icon-egg   { background: #ffeeaa; color: #6a5510; border-color: #baa030; }
.icon-chicken { background: #f7c9a0; color: #7a3810; border-color: #b46b20; }
.icon-mutton  { background: #d9a690; color: #5a1a10; border-color: #7a3a20; }
.icon-basicjoker, .icon-proteinjoker { background: #d5b8f0; color: #4a1e70; border-color: #6a3fa0; }
.icon-unique { background: linear-gradient(135deg, #f4b731, #d97706); color: #fff; border-color: #a0570f; }

/* Bigger chip used INSIDE cards — icon dominant with a small label */
.icon-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255,255,255,0.5);
  border: 1.5px solid rgba(0,0,0,0.2);
  color: var(--ink);
  line-height: 1;
  gap: 0.15rem;
}
.icon-chip .ic-g { font-size: 1.5rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15)); }
.icon-chip .ic-l { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em; }
.icon-chip.icon-spice { background: linear-gradient(180deg, #ffe0b3, #f6c37d); color: #7a4a10; border-color: #b98832; }
.icon-chip.icon-paste { background: linear-gradient(180deg, #dfd0a8, #c8b58a); color: #4a3810; border-color: #7a6b40; }
.icon-chip.icon-curd  { background: linear-gradient(180deg, #f8f8e0, #e8e8c8); color: #5a5a20; border-color: #a4a48c; }
.icon-chip.icon-egg   { background: linear-gradient(180deg, #ffeeaa, #f4d670); color: #6a5510; border-color: #baa030; }
.icon-chip.icon-chicken { background: linear-gradient(180deg, #f7c9a0, #e59b60); color: #7a3810; border-color: #b46b20; }
.icon-chip.icon-mutton  { background: linear-gradient(180deg, #d9a690, #b66850); color: #5a1a10; border-color: #7a3a20; }
.icon-chip.icon-basicjoker, .icon-chip.icon-proteinjoker {
  background: linear-gradient(180deg, #d5b8f0, #b088d8); color: #4a1e70; border-color: #6a3fa0;
}

/* Info icon (ⓘ) */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.2);
  color: var(--saffron-light);
  border: 1px solid rgba(217, 119, 6, 0.5);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 0.35rem;
  vertical-align: middle;
  transition: all 0.15s;
  font-style: normal;
}
.info-icon:hover { background: var(--saffron); color: var(--ink); transform: scale(1.1); }
/* Info icon in dark sidebar */
.sidebar .info-icon,
.section-heading .info-icon {
  background: rgba(244, 183, 49, 0.2);
  color: var(--saffron-light);
  border-color: rgba(244, 183, 49, 0.6);
}
/* Info icon in parchment (modal/light) */
.parchment .info-icon,
.modal .info-icon,
.player-tile .info-icon {
  background: rgba(217, 119, 6, 0.2);
  color: var(--crimson-dark);
  border-color: var(--border-dark);
}

/* Guide button in guidance panel */
.btn-guide {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--emerald) 0%, #0a4426 100%);
  color: var(--cream);
  border: 1px solid var(--saffron-light);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
  transition: all 0.15s;
}
.btn-guide:hover { background: linear-gradient(135deg, #0a4426 0%, var(--emerald) 100%); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15,81,50,0.4); }

/* Step-by-step guide */
.step-guide { display: flex; flex-direction: column; gap: 0.65rem; }
.step-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.7rem;
  background: rgba(217, 119, 6, 0.1);
  border-left: 4px solid var(--saffron);
  border-radius: 6px;
}
.step-n {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--saffron);
  color: var(--cream);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.4);
}
.step-txt { line-height: 1.5; font-size: 0.92rem; color: var(--ink); }

/* Tile note (procurement / unique) */
.tile-note {
  font-size: 0.72rem;
  color: var(--saffron-light);
  margin-top: 0.2rem;
  padding: 0.15rem 0.35rem;
  background: rgba(217, 119, 6, 0.15);
  border-radius: 4px;
  border-left: 2px solid var(--saffron);
}

/* ==== DASTA / GUEST / FARMAN ==== */
.dasta-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dasta-card {
  background: linear-gradient(135deg, #fef3c7, #fbdd8b);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  min-width: 180px;
  max-width: 240px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(184, 134, 11, 0.3);
  position: relative;
}
.dasta-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(184, 134, 11, 0.5); }
.dasta-card.used { opacity: 0.5; transform: rotate(4deg); cursor: not-allowed; }
.dasta-card.rare { background: linear-gradient(135deg, #fbe4ff, #d8b3ff); border-color: #6a3fa0; }
.dasta-card .dasta-name { font-weight: 800; color: var(--crimson-dark); font-size: 0.85rem; margin-bottom: 0.2rem; }
.dasta-card .dasta-effect { font-size: 0.75rem; line-height: 1.25; }
.dasta-card .dasta-flavor { font-style: italic; opacity: 0.7; font-size: 0.7rem; margin-top: 0.2rem; }

.guest-card {
  background: linear-gradient(135deg, #ffe8d1, #f2b871);
  border: 3px double var(--crimson);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--ink);
}
.guest-name { font-size: 1.05rem; font-weight: 800; color: var(--crimson-dark); }
.guest-role { font-style: italic; font-size: 0.85rem; color: var(--emerald-dark); margin-bottom: 0.35rem; }
.guest-recipe { font-size: 0.85rem; margin-top: 0.35rem; }
.guest-recipe .icon-pill { margin-right: 0.2rem; }
.guest-ap { font-weight: 700; color: var(--crimson); font-size: 0.9rem; margin-top: 0.35rem; }
.guest-flavor { font-size: 0.75rem; font-style: italic; opacity: 0.8; margin-top: 0.35rem; line-height: 1.3; }
.guest-empty { padding: 0.75rem; color: var(--parchment); text-align: center; font-style: italic; }

.farman-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.farman-card {
  background: linear-gradient(135deg, #ffe0e0, #f5a0a0);
  border: 2px solid var(--crimson);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--ink);
  min-width: 170px;
  max-width: 250px;
  font-size: 0.78rem;
}
.farman-card.inactive { opacity: 0.55; transform: rotate(-3deg); }
.farman-card.claimed { opacity: 0.45; text-decoration: line-through; }
.farman-name { font-weight: 800; color: var(--crimson-dark); font-size: 0.8rem; }
.farman-req { font-size: 0.72rem; margin-top: 0.2rem; line-height: 1.25; }
.farman-reward { font-size: 0.75rem; color: var(--emerald-dark); font-weight: 700; margin-top: 0.25rem; }
.farman-claimed-by { font-size: 0.7rem; color: var(--crimson); margin-top: 0.2rem; }

/* ==== MARKET EVENTS ==== */
.event-card {
  background: linear-gradient(135deg, #ffd8d8, #f4a0a0);
  border: 2px solid var(--crimson);
  border-radius: 6px;
  padding: 0.5rem;
  margin-bottom: 0.4rem;
  color: var(--ink);
  font-size: 0.8rem;
}
.event-card .event-day { font-size: 0.7rem; color: var(--crimson-dark); font-weight: 700; }
.event-card .event-name { font-weight: 700; margin: 0.15rem 0; }
.event-card.past { opacity: 0.4; }
.event-card.active { box-shadow: 0 0 0 2px var(--saffron); }

/* ==== HAND & ACTIONS ==== */
.hand {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  max-height: 34vh;
  overflow-y: auto;
  padding: 0.15rem;
}
.hand .card { min-height: 50px; padding: 0.4rem 0.5rem; }
.action-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.action-panel .btn-small { text-align: left; padding: 0.5rem 0.7rem; }
.action-info {
  font-size: 0.8rem;
  color: var(--parchment);
  padding: 0.4rem 0.5rem;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  line-height: 1.35;
}

.guidance {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.28), rgba(184, 134, 11, 0.18));
  border: 1px solid rgba(244, 183, 49, 0.5);
  border-left: 3px solid var(--saffron-light);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.5rem;
  color: var(--cream);
}
.guidance-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--saffron-light);
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}
.guidance-what {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--parchment);
  margin-bottom: 0.3rem;
}
/* removed old guidance-list — replaced by step-guide modal via "What should I do?" button */

.pass-progress {
  background: rgba(217, 119, 6, 0.22);
  padding: 0.45rem 0.6rem;
  border-radius: 5px;
  font-size: 0.85rem;
  color: var(--cream);
  border-left: 3px solid var(--saffron);
}
.pass-progress b { color: var(--saffron-light); }

.pass-tracker {
  background: rgba(217, 119, 6, 0.15);
  border: 1px solid rgba(244, 183, 49, 0.4);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}
.pass-tracker-title {
  font-size: 0.72rem;
  color: var(--saffron-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-align: center;
}
.pass-blocks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.3rem; }
.pass-block {
  background: rgba(0,0,0,0.25);
  border-radius: 6px;
  padding: 0.35rem;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.2s;
}
.pass-block.done { opacity: 0.55; background: rgba(15, 81, 50, 0.25); border-color: var(--emerald); }
.pass-block.current { background: var(--saffron); color: var(--ink); border-color: var(--saffron-light); box-shadow: 0 2px 6px rgba(217, 119, 6, 0.5); }
.pass-block.current .pass-label,
.pass-block.current .pass-need { color: var(--ink); }
.pass-label { font-size: 0.72rem; font-weight: 800; color: var(--saffron-light); }
.pass-dots { font-size: 0.9rem; margin: 0.15rem 0; letter-spacing: 0.1rem; }
.pass-dot { color: rgba(255,255,255,0.2); }
.pass-dot.filled { color: var(--emerald); text-shadow: 0 0 6px rgba(15,81,50,0.5); }
.pass-block.current .pass-dot { color: rgba(0,0,0,0.2); }
.pass-block.current .pass-dot.filled { color: var(--emerald-dark); text-shadow: 0 0 4px rgba(255,255,255,0.5); }
.pass-none { opacity: 0.4; font-style: italic; }
.pass-need { font-size: 0.65rem; opacity: 0.7; }

.mode-toggle {
  display: flex;
  gap: 0.25rem;
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  padding: 3px;
}
.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--parchment);
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.mode-btn.active {
  background: var(--saffron);
  color: var(--ink);
}
.held-dasta {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(217,119,6,0.4);
  border-radius: 5px;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  color: var(--cream);
}
.held-dasta.used { opacity: 0.4; }
.held-dasta:hover:not(.used) { background: rgba(217,119,6,0.2); }
.held-dasta .name { font-weight: 700; color: var(--saffron-light); }

/* ==== FOOTER ==== */
.game-footer {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.55);
  border-top: 2px solid var(--saffron);
  align-items: center;
  color: var(--cream);
}
.prompt-bar {
  flex: 1;
  font-size: 0.95rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255,255,255,0.06);
  border-left: 3px solid var(--saffron);
  border-radius: 4px;
  font-style: italic;
}
.footer-actions { display: flex; gap: 0.5rem; }

/* ==== MODAL ==== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal { max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 1.5rem; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}
.modal-header h3 { color: var(--crimson-dark); }
.modal-header .btn-ghost { color: var(--ink); border-color: var(--ink); background: rgba(255,255,255,0.4); }
.modal-body { color: var(--ink); font-size: 0.95rem; line-height: 1.5; }
.modal-body ul { margin: 0.5rem 0 0.5rem 1.5rem; }
.modal-body h4 { color: var(--crimson-dark); margin-top: 0.75rem; }
.modal-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: var(--cream);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  border-left: 3px solid var(--saffron);
  font-size: 0.95rem;
  z-index: 200;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ==== END SCREEN ==== */
#end { align-items: flex-start; justify-content: center; padding: 2rem; overflow-y: auto; }
.end-card { max-width: 900px; width: 100%; padding: 2rem 2.5rem; }
.end-card h1 { text-align: center; }

.end-banner {
  text-align: center;
  padding: 1.25rem 1rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.35), rgba(244, 183, 49, 0.55));
  border: 2px solid var(--saffron);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.4);
}
.end-crown { font-size: 2.4rem; line-height: 1; }
.end-winner-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--crimson-dark);
  margin-top: 0.3rem;
  letter-spacing: 0.02em;
}
.end-winner-title {
  font-style: italic;
  color: var(--emerald-dark);
  font-size: 1rem;
  margin-top: 0.2rem;
}
.end-winner-ap {
  font-size: 2rem;
  font-weight: 800;
  color: var(--crimson-dark);
  margin-top: 0.5rem;
}
.end-winner-ap span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--emerald-dark);
  font-style: italic;
}

.report-section-h {
  color: var(--crimson-dark);
  font-size: 1.15rem;
  border-bottom: 1.5px solid var(--border-dark);
  padding-bottom: 0.3rem;
  margin: 1.5rem 0 0.75rem 0;
}

.chef-report {
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--border-dark);
  border-left: 5px solid var(--player-color, var(--saffron));
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
}
.chef-report[data-color="crimson"] { --player-color: #b91c1c; }
.chef-report[data-color="emerald"] { --player-color: #059669; }
.chef-report[data-color="sapphire"] { --player-color: #2563eb; }
.chef-report[data-color="saffron"] { --player-color: #d97706; }
.chef-report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dotted rgba(0,0,0,0.2);
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}
.chef-name { font-weight: 800; font-size: 1.05rem; color: var(--crimson-dark); }
.chef-rank { font-size: 0.85rem; color: var(--emerald-dark); font-style: italic; }
.chef-ap { font-size: 1rem; font-weight: 700; color: var(--saffron); }
.chef-report-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.chef-col h4 {
  color: var(--emerald-dark);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0.5rem 0 0.35rem 0;
}
.chef-col h4:first-child { margin-top: 0; }
.chef-col ul { list-style: none; padding-left: 0; margin: 0; }
.chef-col li {
  font-size: 0.9rem;
  padding: 0.2rem 0;
  border-bottom: 1px dotted rgba(0,0,0,0.08);
}
.chef-col li:last-child { border-bottom: none; }
.chef-col .end-total { border-top: 1px solid var(--border-dark); padding-top: 0.3rem; margin-top: 0.3rem; }
.chef-col .end-neg { color: var(--crimson); }
.chef-col .end-final {
  font-weight: 800;
  font-size: 1rem;
  color: var(--crimson-dark);
  border-top: 2px double var(--border-dark);
  padding-top: 0.3rem;
  margin-top: 0.3rem;
}

.day-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.day-block {
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 0.55rem;
}
.day-block-head {
  font-weight: 800;
  color: var(--crimson-dark);
  font-size: 0.9rem;
  border-bottom: 1px dotted rgba(0,0,0,0.2);
  padding-bottom: 0.2rem;
  margin-bottom: 0.3rem;
}
.day-block-body { font-size: 0.75rem; }
.log-line {
  padding: 0.15rem 0;
  line-height: 1.35;
  border-bottom: 1px dotted rgba(0,0,0,0.08);
}
.log-line.critical { color: var(--crimson); font-weight: 500; }
.log-line.good { color: var(--emerald-dark); }

.full-ledger summary {
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  font-weight: 700;
  color: var(--crimson-dark);
  font-size: 0.9rem;
}
.ledger-full {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(0,0,0,0.03);
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.end-actions-inline {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Print stylesheet — clean layout for saving as PDF */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  #setup, #game, .game-header, .header-right, .end-actions-inline {
    display: none !important;
  }
  #end {
    padding: 0;
    display: block !important;
    background: white;
  }
  .end-card {
    max-width: 100%;
    box-shadow: none;
    border: none;
    background: white !important;
  }
  .parchment::before { display: none; }
  .end-banner {
    background: none;
    border: 2px solid #8b1a1a;
    box-shadow: none;
  }
  .chef-report {
    page-break-inside: avoid;
    background: #f9f2df !important;
  }
  .day-block { page-break-inside: avoid; }
  details { page-break-before: always; }
  .full-ledger summary::after { content: ' (expanded below)'; }
  .full-ledger[open] .ledger-full { max-height: none; overflow: visible; }
  .full-ledger { open: true; }
  .full-ledger:not([open]) .ledger-full { display: block !important; max-height: none; }
}
.end-podium {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.end-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: rgba(255,255,255,0.35);
  border-left: 5px solid var(--player-color);
  border-radius: 6px;
}
.end-row.winner { background: linear-gradient(135deg, rgba(217, 119, 6, 0.35), rgba(244, 183, 49, 0.55)); box-shadow: 0 4px 12px rgba(217,119,6,0.4); }
.end-rank { font-size: 1.4rem; font-weight: 800; color: var(--crimson-dark); text-align: center; }
.end-name { font-weight: 700; font-size: 1.05rem; }
.end-ap { font-weight: 800; font-size: 1.3rem; color: var(--emerald-dark); }
.end-breakdown { font-size: 0.75rem; opacity: 0.75; margin-top: 0.15rem; }

/* ==== LEDGER LOG ==== */
.log-list { max-height: 60vh; overflow-y: auto; }
.log-day-header {
  font-weight: 800;
  color: var(--crimson);
  border-bottom: 1px solid var(--border-dark);
  margin-top: 0.75rem;
  padding-bottom: 0.2rem;
}
.log-entry {
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
  border-bottom: 1px dotted rgba(0,0,0,0.15);
}
.log-entry.critical { color: var(--crimson); font-weight: 600; }
.log-entry.good { color: var(--emerald-dark); }

/* Player color helpers set inline */
.player-tile[data-color="crimson"] { --player-color: #b91c1c; }
.player-tile[data-color="emerald"] { --player-color: #059669; }
.player-tile[data-color="sapphire"] { --player-color: #2563eb; }
.player-tile[data-color="saffron"] { --player-color: #d97706; }
.turn-chip[data-color="crimson"] { --player-color: #b91c1c; }
.turn-chip[data-color="emerald"] { --player-color: #059669; }
.turn-chip[data-color="sapphire"] { --player-color: #2563eb; }
.turn-chip[data-color="saffron"] { --player-color: #d97706; }
.end-row[data-color="crimson"] { --player-color: #b91c1c; }
.end-row[data-color="emerald"] { --player-color: #059669; }
.end-row[data-color="sapphire"] { --player-color: #2563eb; }
.end-row[data-color="saffron"] { --player-color: #d97706; }

/* ==== RESPONSIVE ==== */
@media (max-width: 1100px) {
  .game-body { grid-template-columns: 220px 1fr 260px; }
}
@media (max-width: 900px) {
  .game-body { grid-template-columns: 1fr; overflow-y: auto; }
  .sidebar { max-height: 40vh; }
}
