:root {
  --primary-color: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --secondary-color: #f59e0b;
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --bg-store: #f0fdf4;
  --shelf-bg: #f8fafc;
  --register-dark: #1e293b;
  --register-screen: #0f172a;
  --register-glow: #10b981;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --border-radius: 16px;
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body.matbutik-game-page {
  font-family: var(--font-main);
  background: #f1f5f9;
  min-height: 100vh;
  color: #1e293b;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Navbar */
.matbutik-navbar {
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #059669 100%);
  color: #ffffff;
  padding: 12px 0;
  box-shadow: 0 4px 15px rgba(4, 120, 87, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.matbutik-brand {
  color: #ffffff;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.matbutik-brand:hover {
  color: #ecfdf5;
  text-decoration: none;
}

.matbutik-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Level Selector Bar */
.level-nav-bar {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 10px 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.level-chip-btn {
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  border-radius: 25px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.level-chip-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.level-chip-btn.active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.level-stars {
  color: #fbbf24;
  font-size: 0.75rem;
}

/* Customer Clipboard & Order */
.customer-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 2px solid #cbd5e1;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.clipboard-header {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 2px solid #f59e0b;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customer-avatar-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.customer-bubble {
  background: #f8fafc;
  border-left: 4px solid #f59e0b;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-style: italic;
  color: #334155;
  margin: 12px 16px;
  border-radius: 0 8px 8px 0;
}

.order-items-list {
  padding: 0 16px 12px;
}

.order-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  transition: background 0.2s;
}

.order-item-row.collected {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.order-item-row.collected .item-status-icon {
  color: #059669;
}

.customer-wallet-box {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 16px;
}

/* Store Shelves & Products */
.shelves-container {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 2px solid #e2e8f0;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.shelf-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.product-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-light);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.2);
}

.product-card.in-cart {
  border-color: var(--primary-color);
  background: #f0fdf4;
}

.product-emoji-wrap {
  width: 72px;
  height: 72px;
  background: #f8fafc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}

.product-card:hover .product-emoji-wrap {
  transform: scale(1.1);
}

.product-name {
  font-weight: 800;
  color: #1e293b;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.product-price-tag {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 20px;
  padding: 4px 12px;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.product-card.has-discount .product-price-tag {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.discount-ribbon {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
  animation: pulseRibbon 2s infinite;
}

@keyframes pulseRibbon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.product-kb-shortcut {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: monospace;
}

.product-qty-controller {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.qty-btn:hover {
  background: #e2e8f0;
}

.qty-btn.add-btn {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-dark);
}

.qty-btn.add-btn:hover {
  background: var(--primary-dark);
}

.qty-display-badge {
  flex-grow: 1;
  font-weight: 800;
  font-size: 1.05rem;
  color: #1e293b;
}

/* Shopping Cart Side Panel */
.cart-panel {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 2px solid #cbd5e1;
  padding: 16px;
  box-shadow: var(--card-shadow);
  margin-top: 16px;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f1f5f9;
}

.cart-table {
  width: 100%;
  font-size: 0.88rem;
}

.cart-table th {
  color: #64748b;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.cart-table td {
  padding: 6px 0;
  vertical-align: middle;
}

.cart-empty-text {
  text-align: center;
  padding: 20px;
  color: #94a3b8;
  font-style: italic;
  font-size: 0.9rem;
}

/* Cash Register / Kassaapparat */
.register-machine {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--border-radius);
  border: 3px solid #334155;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.1);
  padding: 20px;
  color: #ffffff;
}

.register-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  font-weight: 800;
}

.register-screen {
  background: #020617;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.6);
  margin-bottom: 18px;
  position: relative;
  font-family: 'Courier New', Courier, monospace;
}

.screen-step-label {
  font-size: 0.78rem;
  color: #38bdf8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.screen-main-prompt {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
  min-height: 28px;
}

.screen-input-area {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid #10b981;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #34d399;
  font-size: 1.6rem;
  font-weight: 800;
}

.screen-input-text {
  letter-spacing: 2px;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.screen-cursor {
  display: inline-block;
  width: 3px;
  height: 24px;
  background: #34d399;
  margin-left: 4px;
  animation: blinkCursor 1s infinite;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Keypad Grid */
.register-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.key-btn {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border: 1px solid #475569;
  border-radius: 10px;
  color: #f8fafc;
  padding: 12px 0;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #0f172a;
  transition: all 0.1s;
}

.key-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0f172a;
}

.key-btn.action-btn-clear {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  border-color: #ef4444;
  color: #ffffff;
}

.key-btn.action-btn-enter {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-color: #34d399;
  color: #ffffff;
  grid-column: span 2;
}

/* Step Wizard Navigation within register */
.step-wizard-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #334155;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.step-dot.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.step-dot.completed {
  background: #059669;
  color: #ffffff;
  border-color: #34d399;
}

/* Virtual Money / Cash Drawer */
.cash-drawer-section {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 2px solid #cbd5e1;
  padding: 16px;
  box-shadow: var(--card-shadow);
  margin-top: 16px;
}

.cash-drawer-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.money-selector-group {
  margin-bottom: 14px;
}

.money-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.coins-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Realistic Swedish Coins */
.coin-item {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15), inset 0 2px 2px rgba(255, 255, 255, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px dashed rgba(0, 0, 0, 0.15);
}

.coin-item:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.coin-1kr {
  background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #92400e 100%);
  color: #fffbeb;
  width: 44px;
  height: 44px;
  font-size: 0.85rem;
}

.coin-2kr {
  background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #78350f 100%);
  color: #fffbeb;
  width: 50px;
  height: 50px;
  font-size: 0.95rem;
}

.coin-5kr {
  background: linear-gradient(135deg, #ca8a04 0%, #eab308 50%, #a16207 100%);
  color: #422006;
  width: 54px;
  height: 54px;
  font-size: 1.05rem;
}

.coin-10kr {
  background: linear-gradient(135deg, #eab308 0%, #facc15 50%, #ca8a04 100%);
  color: #422006;
  width: 46px;
  height: 46px;
  font-size: 0.95rem;
  border: 3px solid #b45309;
}

/* Realistic Swedish Bills */
.bills-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.bill-item {
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

.bill-item:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.bill-20kr {
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
  color: #ffffff;
}

.bill-50kr {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  color: #ffffff;
}

.bill-100kr {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  color: #ffffff;
}

.bill-200kr {
  background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  color: #ffffff;
}

.bill-500kr {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: #ffffff;
}

/* Change Tray (Växelbricka) */
.change-tray {
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 12px;
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tray-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tray-chip .remove-coin {
  cursor: pointer;
  color: #ef4444;
  font-weight: bold;
}

/* Helper Scratchpad / Räkne-ledtråd */
.math-scratchpad {
  background: #fffbeb;
  border: 2px solid #fef08a;
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 0.88rem;
  color: #713f12;
}

.math-scratchpad-title {
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Feedback Alert Animation */
.feedback-banner {
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-success {
  background: #ecfdf5;
  color: #065f46;
  border: 2px solid #a7f3d0;
}

.feedback-error {
  background: #fef2f2;
  color: #991b1b;
  border: 2px solid #fecaca;
}

/* Keyboard Guide Popover/Modal */
.kbd-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 0 #94a3b8;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: monospace;
  font-weight: 800;
  color: #334155;
}

/* Victory / Next Level Modal */
.modal-store {
  border-radius: 20px;
  border: 3px solid #10b981;
  overflow: hidden;
}

.modal-store .modal-header {
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  color: #ffffff;
  border-bottom: none;
}

.celebration-icon {
  font-size: 3.5rem;
  animation: bounceCelebration 1s ease infinite alternate;
}

@keyframes bounceCelebration {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-8px) scale(1.08); }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .product-emoji-wrap {
    width: 56px;
    height: 56px;
    font-size: 2rem;
  }
}

@media (max-width: 575.98px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .register-keypad {
    gap: 6px;
  }
  .key-btn {
    padding: 10px 0;
    font-size: 1.15rem;
  }
}
