@font-face {
  font-family: "Montserrat";
  src: url("/vendor/fonts/montserrat-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/vendor/fonts/montserrat-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #faf8f5;
  color: #333;
  line-height: 1.5;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a8a7d;
  text-align: center;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.25rem;
  color: #1a8a7d;
  margin-bottom: 1rem;
}

.subtitle {
  text-align: center;
  color: #777;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* Landing page */
.landing h1 {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

.landing .subtitle {
  font-size: 1.15rem;
  color: #888;
}

.nab-logo {
  display: block;
  height: 40px;
  margin: 0 auto 1rem;
}

.nab-logo-sm {
  height: 24px;
}

.landing-hero {
  text-align: center;
  margin-bottom: 1rem;
}

.hero-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.card-desc {
  color: #999;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  margin-top: -0.5rem;
}

.landing-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(78, 205, 196, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Forms */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.25rem;
  margin-top: 1rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: #4ecdc4;
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.15);
}

button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #4ecdc4;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.2s, transform 0.15s;
}

button:hover {
  background: #3dbdb5;
}

button:active {
  background: #2fa89f;
  transform: scale(0.97);
}

button:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Lobby */
.lobby {
  max-width: 600px;
  margin: 0 auto;
}

.room-info {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.room-code .label {
  display: block;
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.room-code .code {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #1a8a7d;
  font-family: monospace;
}

#copy-link {
  display: block;
  margin: 0.75rem auto 0;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: #eee;
  color: #333;
}

#copy-link:active {
  background: #ddd;
}

.player-list {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.player-list ul {
  list-style: none;
}

.player-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
}

.player-item:last-child {
  border-bottom: none;
}

#lobby-actions {
  text-align: center;
  margin-top: 1.5rem;
}

#lobby-actions p {
  color: #666;
  font-style: italic;
}

.error {
  background: #fee;
  color: #c33;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: center;
}

/* Game placeholder */
.game-placeholder {
  text-align: center;
  padding: 3rem 1rem;
}

.game-placeholder pre {
  text-align: left;
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* Results screen */
.results {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.results-header {
  text-align: center;
  margin-bottom: 2rem;
}

.results-header h1 {
  font-size: 2.5rem;
  color: #1a8a7d;
}

.results-subtitle {
  color: #666;
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

.reveal-intro {
  text-align: center;
  color: #666;
  font-style: italic;
  margin-bottom: 1.5rem;
}

.player-result {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #ddd;
}

.player-result.winner {
  border-left-color: #4a8c1c;
  background: #f8fff0;
}

.player-result.is-me {
  border-left-color: #3b82f6;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.player-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.winner-badge {
  background: #4a8c1c;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.result-profile {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-condition {
  flex: 1;
  min-width: 180px;
  background: linear-gradient(135deg, #e0f7f5, #e8faf8);
  border: 2px solid #4ecdc4;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}

.result-condition h3 {
  color: #1a8a7d;
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
}

.profile-description {
  color: #555;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.nutrient-info,
.prevention-info {
  color: #666;
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.condition-needs {
  color: #1a8a7d;
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.result-pyramid-visual {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #faf8f5;
  border-radius: 8px;
}

.completion-bar {
  background: #eee;
  border-radius: 8px;
  height: 28px;
  position: relative;
  margin: 1rem 0 0.75rem;
  overflow: hidden;
}

.completion-fill {
  height: 100%;
  background: #4ecdc4;
  border-radius: 8px;
  transition: width 0.5s;
}

.completion-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
}

.category-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.cat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
}

.cat-row.carbs {
  background: rgba(244, 164, 96, 0.15);
}
.cat-row.protein {
  background: rgba(232, 142, 142, 0.15);
}
.cat-row.vitamins {
  background: rgba(144, 198, 149, 0.15);
}
.cat-row.fats {
  background: rgba(240, 210, 100, 0.15);
}

.play-again-btn {
  display: block;
  margin: 2rem auto;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  background: #4a8c1c;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.play-again-btn:active {
  background: #3a7015;
}

/* ===========================
   Game Board
   =========================== */

.game-board {
  max-width: 900px;
  margin: 0 auto;
}

/* Header */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: white;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Profile card */
.profile-card {
  margin-bottom: 1.5rem;
}

.profile-card-inner {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-card-inner h3 {
  width: 100%;
  color: #1a8a7d;
  font-size: 1.1rem;
  margin-bottom: 0;
}

.condition-card {
  flex: 1;
  min-width: 220px;
  background: linear-gradient(135deg, #e0f7f5, #e8faf8);
  border: 2px solid #4ecdc4;
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.condition-card h4 {
  color: #1a8a7d;
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.profile-desc {
  color: #444;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.profile-nutrient,
.profile-foods {
  color: #555;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.condition-adds {
  color: #1a8a7d;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.room-label {
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

.turn-indicator {
  font-weight: 700;
  font-size: 1rem;
  color: #666;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  background: #f0f0f0;
}

.turn-indicator.my-turn {
  background: #e0f7f5;
  color: #1a8a7d;
}

.turn-timer {
  font-weight: 600;
  font-size: 0.9rem;
  color: #666;
  min-width: 2.5rem;
  text-align: center;
}

.turn-timer.urgent {
  color: #dc3545;
  font-weight: 700;
}

.kill-btn {
  background: #dc3545;
  color: white;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  margin-top: 0;
  min-height: 36px;
}

.kill-btn:active {
  background: #b02a37;
}

.bag-count {
  font-size: 0.9rem;
  color: #888;
  font-weight: 500;
}

/* Player pyramid section */
.my-pyramid-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Profile target */
.profile-target {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.target-item {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.target-item.carbs {
  background: rgba(244, 164, 96, 0.15);
  color: #8b5e2b;
}

.target-item.protein {
  background: rgba(255, 138, 128, 0.15);
  color: #8b3a3a;
}

.target-item.vitamins {
  background: rgba(129, 199, 132, 0.15);
  color: #2e7d32;
}

.target-item.fats {
  background: rgba(249, 213, 110, 0.15);
  color: #7a6200;
}

/* Pyramid — 3-column layout: base | line | conditions */
.pyramid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  container-type: inline-size;
}

.pyramid-columns {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.pyramid-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pyramid-base .pyramid-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

.pyramid-cond .pyramid-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 5cqi;
}

.row-slots {
  display: flex;
  gap: 0.35rem;
}

.tier-label {
  font-size: 0.75rem;
  font-weight: 600;
  width: 5.5rem;
  color: #555;
  flex-shrink: 0;
  text-align: right;
}

.pyramid-divider {
  width: 2px;
  background: #aaa;
  margin: 0 0.5rem;
  flex-shrink: 0;
  border-radius: 1px;
}

/* Food tiles — width scales with container via cqi units */
.food-tile {
  width: 7cqi;
  height: 5cqi;
  min-height: 28px;
  flex-shrink: 0;
  padding: 0.2rem;
  border-radius: 6px;
  font-size: clamp(0.5rem, 1.2cqi, 0.8rem);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.2;
}

.food-tile:active {
  transform: scale(0.95);
}

.food-tile.empty {
  border: 2px dashed #ccc;
  background: #fafafa;
  cursor: default;
}

.food-tile.empty.locked {
  border-color: #ddd;
  background: #f0f0f0;
  opacity: 0.4;
}

.food-tile.base-done {
  opacity: 0.5;
}

.base-check {
  text-align: center;
  color: #1a8a7d;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  animation: pop-in 0.4s ease-out;
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.base-check::before {
  content: "\2714 ";
}

.food-tile.empty:active {
  transform: none;
}

.food-tile.filled.carbs {
  background: #f4a460;
  color: #5a3000;
}

.food-tile.filled.protein {
  background: #ff8a80;
  color: #5a1515;
}

.food-tile.filled.vitamins {
  background: #81c784;
  color: #1b5e20;
}

.food-tile.filled.fats {
  background: #f9d56e;
  color: #5a4800;
}

/* Opponents — display in a row with mini pyramids */
.opponents-section {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.opponents-section h2 {
  margin-bottom: 0.75rem;
}

#opponents {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.opponent-card {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  border: 1px solid #eee;
  flex: 1;
  min-width: 200px;
}

.opponent-card.disconnected {
  opacity: 0.6;
}

.opponent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.opponent-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.opponent-total {
  font-size: 0.8rem;
  color: #888;
  font-weight: 500;
}

/* Mini pyramid for opponents */
.pyramid-columns.mini {
  justify-content: center;
}

.pyramid-columns.mini .pyramid-row {
  gap: 0.15rem;
  min-height: 22px;
}

.pyramid-columns.mini .pyramid-col {
  gap: 0.15rem;
}

.pyramid-columns.mini .row-slots {
  gap: 0.15rem;
}

.pyramid-columns.mini .pyramid-divider {
  margin: 0 0.25rem;
}

.food-tile.mini {
  width: 36px;
  height: 22px;
  min-height: 22px;
  padding: 0.1rem 0.15rem;
  font-size: 0.55rem;
  cursor: pointer;
}

.food-tile.empty.mini {
  min-height: 22px;
  border-width: 1px;
}

/* Market section */
.market-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.market-section h2 {
  margin-bottom: 0.75rem;
}

#market-count {
  font-size: 0.85rem;
  font-weight: 400;
  color: #888;
}

.market-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.market-tile {
  min-width: 44px;
  min-height: 60px;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.2s;
  text-align: center;
}

.market-tile:active {
  transform: scale(0.95);
}

.market-tile.takeable {
  border-color: #4a8c1c;
  box-shadow: 0 2px 6px rgba(74, 140, 28, 0.25);
}

.market-tile.carbs {
  background: rgba(244, 164, 96, 0.25);
}

.market-tile.protein {
  background: rgba(232, 142, 142, 0.25);
}

.market-tile.vitamins {
  background: rgba(144, 198, 149, 0.25);
}

.market-tile.fats {
  background: rgba(240, 210, 100, 0.25);
}

.market-tile .food-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 0.25rem;
}

.market-tile .tile-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.market-tile .tile-category {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
}

.empty-market {
  color: #999;
  font-style: italic;
}

/* Actions section */
.actions-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.waiting-turn {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 1rem;
}

.turn-actions h3,
.pending-draw h3 {
  margin-bottom: 1rem;
  color: #1a8a7d;
}

.action-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.action-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 44px;
}

.draw-btn {
  background: #3b82f6;
}

.draw-btn:active {
  background: #2563eb;
}

.draw-btn:disabled {
  background: #999;
}

.or-divider {
  color: #888;
  font-size: 0.9rem;
}

/* Drawn tiles */
.drawn-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.drawn-tile {
  min-width: 120px;
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}

.drawn-tile.carbs {
  background: rgba(244, 164, 96, 0.2);
  border: 2px solid #f4a460;
}

.drawn-tile.protein {
  background: rgba(232, 142, 142, 0.2);
  border: 2px solid #e88e8e;
}

.drawn-tile.vitamins {
  background: rgba(144, 198, 149, 0.2);
  border: 2px solid #90c695;
}

.drawn-tile.fats {
  background: rgba(240, 210, 100, 0.2);
  border: 2px solid #f0d264;
}

.drawn-tile .food-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.25rem;
}

.drawn-tile .tile-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.drawn-tile .tile-category {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.place-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  min-height: 44px;
  background: #4a8c1c;
  margin-top: 0;
}

.place-btn:active {
  background: #3a7015;
}

.place-btn.disabled {
  background: #bbb;
  cursor: not-allowed;
}

.discard-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: #e88e8e;
  color: #4a1010;
  font-size: 1rem;
  min-height: 44px;
  margin-top: 0.5rem;
}

.discard-btn:active {
  background: #d57070;
}

/* Action error */
.action-error {
  background: #fee;
  color: #c33;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* Info panel */
.info-panel {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  min-height: 80px;
}

.info-placeholder {
  color: #999;
  font-style: italic;
  text-align: center;
}

.food-info h3 {
  color: #1a8a7d;
  margin-bottom: 0.5rem;
}

.info-category {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.info-nutrients {
  margin-bottom: 0.5rem;
}

.info-fact {
  color: #555;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.info-helps {
  color: #1a8a7d;
  font-size: 0.9rem;
}

/* Results inline (game-over within game board view) */
.results-screen {
  text-align: center;
  padding: 2rem 1rem;
}

.results-screen h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.results-players {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.result-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #ddd;
}

.result-card.winner {
  border-left-color: #4a8c1c;
  background: #f8fff0;
}

.result-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.result-total {
  color: #666;
  font-size: 0.9rem;
}

#back-home-btn {
  margin-top: 1.5rem;
  padding: 0.75rem 2rem;
}

/* Results animations */
.completion-fill {
  animation: bar-fill 0.8s ease-out 1.5s both;
}

@keyframes bar-fill {
  from {
    width: 0 !important;
  }
}
