/* Dosa Tycoon — base.css (SHELL)
 * Design tokens, reset, the scaled 1600×900 stage with its themed surround and layer stack,
 * and the shared component classes (.dt-panel, .dt-btn, .dt-chip, .dt-title)
 * used by the shell screens, the HUD and the management windows. */

:root {
  --c-turmeric: #F5B301;
  --c-marigold: #FF9A1F;
  --c-kumkum: #C8102E;
  --c-maroon: #8E1B2D;
  --c-leaf: #2E8B3D;
  --c-leaf-dark: #17592A;
  --c-coffee: #4A2C1A;
  --c-jaggery: #A8651E;
  --c-gold: #E8A33D;
  --c-cream: #FFF4DC;
  --c-jasmine: #FFFDF5;
  --c-steel: #C9D1D9;
  --c-teal: #0E8C8C;
  --c-ink: #3A1F12;
  --c-good: #5DBB3F;
  --c-perfect: #FFC400;
  --c-crisp: #FF8A1F;
  --c-burnt: #D7263D;

  --font-display: 'Lilita One', 'Baloo 2', system-ui, sans-serif;
  --font-ui: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease-out-back: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* Kolam lattice tiles (turmeric on dark, ink on paper) for watermark backgrounds. */
  --kolam-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140' fill='none' stroke='%23F5B301' stroke-width='2' stroke-opacity='.1'%3E%3Cpath d='M70 8 Q84 42 132 70 Q84 98 70 132 Q56 98 8 70 Q56 42 70 8Z'/%3E%3Cpath d='M70 36 Q78 58 104 70 Q78 82 70 104 Q62 82 36 70 Q62 58 70 36Z'/%3E%3Ccircle cx='70' cy='70' r='9'/%3E%3Ccircle cx='0' cy='0' r='16'/%3E%3Ccircle cx='140' cy='0' r='16'/%3E%3Ccircle cx='0' cy='140' r='16'/%3E%3Ccircle cx='140' cy='140' r='16'/%3E%3Cg fill='%23F5B301' fill-opacity='.16' stroke='none'%3E%3Ccircle cx='70' cy='70' r='3'/%3E%3Ccircle cx='0' cy='70' r='3'/%3E%3Ccircle cx='140' cy='70' r='3'/%3E%3Ccircle cx='70' cy='0' r='3'/%3E%3Ccircle cx='70' cy='140' r='3'/%3E%3Ccircle cx='35' cy='35' r='2.2'/%3E%3Ccircle cx='105' cy='35' r='2.2'/%3E%3Ccircle cx='35' cy='105' r='2.2'/%3E%3Ccircle cx='105' cy='105' r='2.2'/%3E%3C/g%3E%3C/svg%3E");
  --kolam-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140' fill='none' stroke='%23A8651E' stroke-width='2' stroke-opacity='.11'%3E%3Cpath d='M70 8 Q84 42 132 70 Q84 98 70 132 Q56 98 8 70 Q56 42 70 8Z'/%3E%3Cpath d='M70 36 Q78 58 104 70 Q78 82 70 104 Q62 82 36 70 Q62 58 70 36Z'/%3E%3Ccircle cx='70' cy='70' r='9'/%3E%3Ccircle cx='0' cy='0' r='16'/%3E%3Ccircle cx='140' cy='0' r='16'/%3E%3Ccircle cx='0' cy='140' r='16'/%3E%3Ccircle cx='140' cy='140' r='16'/%3E%3Cg fill='%23A8651E' fill-opacity='.16' stroke='none'%3E%3Ccircle cx='70' cy='70' r='3'/%3E%3Ccircle cx='0' cy='70' r='3'/%3E%3Ccircle cx='140' cy='70' r='3'/%3E%3Ccircle cx='70' cy='0' r='3'/%3E%3Ccircle cx='70' cy='140' r='3'/%3E%3Ccircle cx='35' cy='35' r='2.2'/%3E%3Ccircle cx='105' cy='35' r='2.2'/%3E%3Ccircle cx='35' cy='105' r='2.2'/%3E%3Ccircle cx='105' cy='105' r='2.2'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- reset ---------- */

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #21090E;
}

body {
  position: fixed;
  inset: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  color: var(--c-ink);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

button::-moz-focus-inner { border: 0; }

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }

ul, ol { list-style: none; }

svg { display: block; }

img, svg, canvas { -webkit-user-drag: none; }

/* ---------- viewport surround + stage ---------- */

#viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    var(--kolam-gold) 50% 50% / 140px 140px,
    radial-gradient(ellipse 80% 70% at 50% 45%, #6E1B2C 0%, #47121E 45%, #2A0B12 80%, #1B070B 100%);
}

/* soft vignette so the kolam fades toward the window edges */
#viewport::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(27, 7, 11, 0) 40%, rgba(27, 7, 11, .75) 100%);
  pointer-events: none;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1600px;
  height: 900px;
  margin: -450px 0 0 -800px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 50% 50%;
  overflow: hidden;
  background: #2A0B12;
  box-shadow:
    0 0 0 3px #1B070B,
    0 0 0 6px rgba(245, 179, 1, .45),
    0 0 0 9px #1B070B,
    0 40px 120px rgba(0, 0, 0, .65);
  opacity: 0;
  contain: layout paint;
  /* no browser pinch or double-tap zoom on the game; scrolling lists inside still pan natively */
  touch-action: none;
}

html.dt-ready #stage {
  opacity: 1;
  transition: opacity .3s ease-out;
}

/* The stage is a stack of full-size layers. The world canvas takes pointer input; the HUD,
 * window and screen layers are click-through and their children opt back in, so a click on
 * an empty area always reaches the world. The two particle canvases never take input. */
#world, #fx-layer, #hud-layer, #window-layer, #screen-layer, #fx-top {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
}

#world { z-index: 1; touch-action: none; }
#fx-layer { z-index: 2; pointer-events: none; }
#hud-layer { z-index: 3; pointer-events: none; }
#window-layer { z-index: 4; pointer-events: none; }
#screen-layer { z-index: 5; pointer-events: none; }
#screen-layer > * { pointer-events: auto; }
#fx-top { z-index: 6; pointer-events: none; }

/* H: a clean look at the restaurant. The windows step aside; the HUD hides itself (or is hidden here if it cannot). */
#stage.dt-clean #window-layer { display: none; }
#stage.dt-clean-all #hud-layer,
#stage.dt-clean-all > .hud--over { visibility: hidden; }

/* Off-screen ruler used once to tell whether the display web font arrived. */
.dt-font-probe {
  position: absolute;
  left: -9999px;
  top: 0;
  font-family: monospace;
  font-size: 80px;
  white-space: nowrap;
  visibility: hidden;
}

.dt-font-probe.is-display { font-family: 'Lilita One', monospace; }

/* Typing fields (price boxes and the like) keep normal text behaviour inside the no-select stage. */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ---------- "rotate your screen" and "needs a bigger screen" cards ----------
 * main.js decides (from the stage scale each orientation would give) and sets a class on <html>. */

#rotate-card,
#small-card,
#old-browser {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    var(--kolam-gold) 50% 50% / 140px 140px,
    radial-gradient(ellipse at 50% 40%, #6E1B2C 0%, #2A0B12 85%);
}

.rotate-card__box {
  width: min(100%, 340px);
  padding: 28px 24px 26px;
  text-align: center;
  color: var(--c-ink);
  background: var(--c-cream);
  border: 4px solid var(--c-ink);
  border-radius: 28px;
  box-shadow: 0 8px 0 var(--c-ink), 0 24px 50px rgba(0, 0, 0, .45);
}

.rotate-card__art {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 10px;
}

.rotate-card__phone,
.rotate-card__arrow {
  position: absolute;
  inset: 6px;
  width: 120px;
  height: 120px;
}

.rotate-card__phone {
  transform-origin: 50% 50%;
  animation: dt-rotate-hint 2.6s var(--ease-out) infinite;
}

.rotate-card__arrow {
  left: -18px;
  top: -6px;
  animation: dt-rotate-arrow 2.6s ease-out infinite;
}

.rotate-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-synthesis: none;
  font-size: 28px;
  line-height: 1.1;
  color: var(--c-kumkum);
  margin-bottom: 8px;
}

.rotate-card__text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

@keyframes dt-rotate-hint {
  0%, 20% { transform: rotate(0deg); }
  55%, 88% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

@keyframes dt-rotate-arrow {
  0%, 15% { opacity: 1; }
  50%, 90% { opacity: 0; }
  100% { opacity: 1; }
}

html.dt-card-rotate #rotate-card,
html.dt-card-small #small-card,
html.dt-old #old-browser { display: flex; }

/* JavaScript is off: the same card, shown by the <noscript> block itself */
.noscript-card {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.small-card__art {
  width: 150px;
  height: 180px;
  margin: -8px auto 2px;
}

.small-card__hint {
  display: none;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--c-jaggery);
}

@media (hover: hover) and (pointer: fine) {
  .small-card__hint { display: block; }
}

.small-card__try {
  margin-top: 14px;
  padding: 6px 14px 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--c-maroon);
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 999px;
  outline: none;
}

/* a phone held sideways is short: chef beside the words instead of above them */
@media (max-height: 520px) {
  #small-card { padding: 12px; }
  #small-card .rotate-card__box {
    display: grid;
    grid-template-columns: 112px 1fr;
    column-gap: 18px;
    align-items: center;
    width: min(100%, 560px);
    padding: 14px 22px 16px;
    text-align: left;
  }
  #small-card .small-card__art { grid-row: 1 / span 4; width: 112px; height: 134px; margin: 0; }
  #small-card .rotate-card__title { font-size: 24px; margin-bottom: 4px; }
  #small-card .rotate-card__text { font-size: 16px; }
  #small-card .small-card__try { justify-self: start; margin-top: 4px; padding-left: 0; padding-right: 0; }
}

.small-card__try:hover { background: rgba(200, 16, 46, .1); }
.small-card__try:focus-visible { box-shadow: 0 0 0 4px var(--c-teal); }

/* ---------- shared components ---------- */

/* Cream paper panel: 4px ink outline, big radius, hard offset shadow. */
.dt-panel {
  position: relative;
  color: var(--c-ink);
  background:
    var(--kolam-ink) 0 0 / 140px 140px,
    linear-gradient(180deg, var(--c-jasmine) 0%, var(--c-cream) 55%, #FBE6BC 100%);
  border: 4px solid var(--c-ink);
  border-radius: 32px;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, .55),
    0 8px 0 var(--c-ink),
    0 22px 40px rgba(30, 8, 4, .35);
}

/* Chunky tactile button. Variants set the three custom properties. */
.dt-btn {
  --btn-face: #FFF7E6;
  --btn-face-2: #FBE3B2;
  --btn-lip: #D8B777;
  --btn-text: var(--c-ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 68px;
  padding: 0 30px 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-synthesis: none;
  font-size: 28px;
  line-height: 1;
  letter-spacing: .5px;
  white-space: nowrap;
  color: var(--btn-text);
  background: linear-gradient(180deg, var(--btn-face) 0%, var(--btn-face-2) 100%);
  border: 4px solid var(--c-ink);
  border-radius: 22px;
  box-shadow:
    inset 0 -7px 0 var(--btn-lip),
    inset 0 3px 0 rgba(255, 255, 255, .55),
    0 6px 0 var(--c-ink);
  transform: translateY(0);
  transition: transform .09s ease-out, box-shadow .09s ease-out, filter .15s ease-out;
  cursor: pointer;
  outline: none;
}

.dt-btn > svg {
  flex: none;
  width: 34px;
  height: 34px;
}

.dt-btn:hover {
  filter: brightness(1.06) saturate(1.05);
  transform: translateY(-2px);
  box-shadow:
    inset 0 -7px 0 var(--btn-lip),
    inset 0 3px 0 rgba(255, 255, 255, .55),
    0 8px 0 var(--c-ink);
}

.dt-btn:active,
.dt-btn.is-pressed {
  filter: brightness(.97);
  transform: translateY(5px);
  box-shadow:
    inset 0 -3px 0 var(--btn-lip),
    inset 0 3px 0 rgba(255, 255, 255, .35),
    0 1px 0 var(--c-ink);
  transition-duration: .04s;
}

.dt-btn:focus-visible {
  outline: 4px solid var(--c-jasmine);
  outline-offset: 3px;
  box-shadow:
    inset 0 -7px 0 var(--btn-lip),
    inset 0 3px 0 rgba(255, 255, 255, .55),
    0 6px 0 var(--c-ink),
    0 0 0 11px var(--c-teal);
}

.dt-btn--primary {
  --btn-face: #F2314F;
  --btn-face-2: var(--c-kumkum);
  --btn-lip: #8C0A1F;
  --btn-text: #FFF6D8;
  text-shadow: 0 3px 0 rgba(90, 6, 20, .85);
}

.dt-btn--primary::after {
  /* turmeric piping just inside the outline */
  content: '';
  position: absolute;
  inset: 3px 3px 9px;
  border: 3px solid var(--c-turmeric);
  border-radius: 15px;
  opacity: .9;
  pointer-events: none;
}

.dt-btn--secondary {
  --btn-face: #FFD44A;
  --btn-face-2: var(--c-turmeric);
  --btn-lip: #C27F00;
  --btn-text: var(--c-ink);
}

.dt-btn--ghost {
  --btn-face: #FFFDF5;
  --btn-face-2: #F6E6C3;
  --btn-lip: #D6BD8B;
  --btn-text: var(--c-ink);
}

.dt-btn--small {
  min-height: 50px;
  padding: 0 20px 5px;
  font-size: 21px;
  border-radius: 17px;
  gap: 8px;
  box-shadow:
    inset 0 -5px 0 var(--btn-lip),
    inset 0 2px 0 rgba(255, 255, 255, .55),
    0 5px 0 var(--c-ink);
}

.dt-btn--small > svg { width: 26px; height: 26px; }
.dt-btn--small.dt-btn--primary::after { inset: 2px 2px 7px; border-width: 2px; border-radius: 11px; }

.dt-btn--small:hover {
  box-shadow:
    inset 0 -5px 0 var(--btn-lip),
    inset 0 2px 0 rgba(255, 255, 255, .55),
    0 7px 0 var(--c-ink);
}

.dt-btn--small:active,
.dt-btn--small.is-pressed {
  transform: translateY(4px);
  box-shadow:
    inset 0 -2px 0 var(--btn-lip),
    inset 0 2px 0 rgba(255, 255, 255, .35),
    0 1px 0 var(--c-ink);
}

.dt-btn--small:focus-visible {
  box-shadow:
    inset 0 -5px 0 var(--btn-lip),
    inset 0 2px 0 rgba(255, 255, 255, .55),
    0 5px 0 var(--c-ink),
    0 0 0 11px var(--c-teal);
}

.dt-btn:disabled,
.dt-btn[aria-disabled="true"],
.dt-btn.is-disabled {
  --btn-face: #E9E0CF;
  --btn-face-2: #D9CDB6;
  --btn-lip: #B8AA90;
  --btn-text: #8B7A66;
  text-shadow: none;
  filter: none;
  transform: none;
  cursor: default;
  box-shadow:
    inset 0 -5px 0 var(--btn-lip),
    inset 0 3px 0 rgba(255, 255, 255, .4),
    0 4px 0 #6B5546;
  border-color: #6B5546;
}

.dt-btn:disabled::after,
.dt-btn[aria-disabled="true"]::after,
.dt-btn.is-disabled::after { display: none; }

.dt-btn:disabled > svg,
.dt-btn[aria-disabled="true"] > svg,
.dt-btn.is-disabled > svg { filter: grayscale(.9); opacity: .65; }

/* Small rounded label / stat pill. */
.dt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 2px 16px 2px 12px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
  color: var(--c-ink);
  background: var(--c-jasmine);
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--c-ink);
}

.dt-chip > svg {
  flex: none;
  width: 28px;
  height: 28px;
}

/* Sign-painter display type: turmeric fill, ink outline, hard drop shadow. */
.dt-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-synthesis: none;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--c-turmeric);
  -webkit-text-stroke: 10px var(--c-ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--c-ink);
}

@media (prefers-reduced-motion: reduce) {
  .rotate-card__phone,
  .rotate-card__arrow { animation: none; }
}
