:root {
  --bg: #1b1410;
  --surface: #241b16;
  --accent: #d9822b;
  --accent-dark: #b5651d;
  --text: #f5ede4;
  --text-dim: #c9b8a8;
  --danger: #b23b3b;
  --success: #4a8f6d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Idle / ambient screen ---------- */

.idle-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.idle-media {
  position: absolute;
  inset: 0;
}

.idle-media img,
.idle-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idle-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.15) 60%, rgba(0,0,0,0.85) 100%);
  pointer-events: none;
}

.idle-lang-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.idle-lang-toggle a {
  padding: 10px 18px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  font-weight: 600;
  font-size: 1rem;
}

.idle-lang-toggle a.active {
  background: var(--accent);
  border-color: var(--accent);
}

.idle-featured-info {
  position: absolute;
  left: 32px;
  bottom: 200px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.idle-featured-name {
  font-size: 2.4rem;
  font-weight: 700;
}

.idle-featured-price {
  font-size: 1.6rem;
  color: var(--accent);
  font-weight: 600;
}

.idle-view-menu-btn {
  position: absolute;
  right: 32px;
  bottom: 200px;
  z-index: 5;
  padding: 22px 40px;
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--accent);
  color: #1b1410;
  border: none;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.idle-thumbnail-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  overflow-x: auto;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
}

.idle-thumb {
  flex: 0 0 auto;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 8px;
  color: var(--text);
}

.idle-thumb.active {
  border-color: var(--accent);
  background: rgba(217,130,43,0.2);
}

.idle-thumb-image {
  width: 100%;
  height: 70px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}

.idle-thumb-name {
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.15;
  max-height: 2.3em;
  overflow: hidden;
}

.idle-thumb-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Browsing screens ---------- */

.browse-screen {
  min-height: 100vh;
  padding-bottom: 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-nav {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.topbar-back,
.topbar-home {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
}

.topbar-title {
  font-size: 1.5rem;
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-toggle {
  display: flex;
  gap: 8px;
}

.lang-toggle a {
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  font-weight: 600;
}

.lang-toggle a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1b1410;
}

.grid {
  display: grid;
  gap: 20px;
  padding: 28px;
}

.grid-categories {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.grid-items {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.category-tile {
  min-height: 140px;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.category-tile .tile-name {
  font-size: 1.4rem;
  font-weight: 700;
}

.item-tile .tile-image {
  height: 150px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.item-tile.unavailable {
  opacity: 0.45;
}

.item-tile .tile-body {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

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

.tile-price {
  font-weight: 700;
  color: var(--accent);
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

.item-detail {
  display: flex;
  flex-direction: column;
  padding: 28px;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.item-detail-media {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
}

.item-detail-media img,
.item-detail-media video {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

.item-detail-info h2 {
  font-size: 2rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-detail-description {
  font-size: 1.15rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.item-detail-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Admin ---------- */

.admin-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
  user-select: text;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-login-form,
.admin-item-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  padding: 28px;
  border-radius: 16px;
  max-width: 520px;
}

.admin-item-form { max-width: 640px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: #16100c;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.field-row {
  display: flex;
  gap: 16px;
}
.field-row .field { flex: 1; }

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.btn {
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  background: var(--accent);
  color: #1b1410;
  display: inline-block;
  text-align: center;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.error-message {
  color: #ff9b9b;
  font-weight: 600;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
}

.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-table img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
}

.media-panel {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 24px;
  border-radius: 16px;
  margin-top: 20px;
}

.media-block {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-preview img,
.media-preview video {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
}

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

.media-actions form {
  display: inline;
}

/* ---------- Small screens (phones) ---------- */
/* The primary target is 20"+ kiosk displays, but the layout degrades
   gracefully down to phone widths so the POC can be demoed on mobile. */

@media (max-width: 700px) {
  .topbar {
    padding: 12px 14px;
    gap: 8px;
  }

  .topbar-nav {
    gap: 6px;
  }

  .topbar-back,
  .topbar-home {
    font-size: 0.85rem;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .lang-toggle {
    gap: 4px;
  }

  .lang-toggle a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .grid {
    gap: 14px;
    padding: 16px;
  }

  .grid-categories {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .grid-items {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .category-tile {
    min-height: 100px;
    padding: 16px;
  }

  .category-tile .tile-name {
    font-size: 1.1rem;
  }

  .item-tile .tile-image {
    height: 110px;
  }

  .item-tile .tile-body {
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .tile-name {
    font-size: 0.95rem;
  }

  .tile-price {
    font-size: 0.9rem;
  }

  .item-detail {
    padding: 16px;
    gap: 16px;
  }

  .item-detail-info h2 {
    font-size: 1.4rem;
  }

  .item-detail-description {
    font-size: 1rem;
  }

  .item-detail-price {
    font-size: 1.3rem;
  }

  /* Idle screen: stack the featured info, the "View Menu" button and the
     thumbnail strip instead of the wide-screen left/right split, which
     overlaps on narrow viewports. */
  .idle-lang-toggle {
    top: 12px;
    right: 12px;
  }

  .idle-lang-toggle a {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .idle-featured-info {
    left: 16px;
    right: 16px;
    bottom: 210px;
    gap: 3px;
  }

  .idle-featured-name {
    font-size: 1.3rem;
  }

  .idle-featured-price {
    font-size: 1.05rem;
  }

  .idle-view-menu-btn {
    left: 16px;
    right: 16px;
    bottom: 150px;
    padding: 14px 20px;
    font-size: 1.05rem;
    border-radius: 12px;
    text-align: center;
    width: auto;
  }

  .idle-thumbnail-strip {
    padding: 8px 10px;
    gap: 8px;
  }

  .idle-thumb {
    width: 80px;
    padding: 5px;
  }

  .idle-thumb-image {
    height: 44px;
  }

  .idle-thumb-name {
    font-size: 0.72rem;
    max-height: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  .idle-thumb-price {
    font-size: 0.72rem;
  }
}
