/* =====================================================================
   Pink Tooth Salon — 16-bit pixel theme
   Blocky borders, hard shadows, no antialiased corners, pixel fonts.
   ===================================================================== */
:root {
  --pink-50: #fff0f6;
  --pink-100: #ffd6e7;
  --pink-200: #ffadd2;
  --pink-300: #ff85b8;
  --pink-400: #f7599b;
  --pink-500: #e84393;
  --pink-600: #c2257a;
  --pink-700: #8f1d5a;
  --white: #fff;
  --gold: #ffd166;
  --ink: #5b2333;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --body: 'VT323', 'Courier New', monospace;
}

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

body {
  font-family: var(--body);
  font-size: 20px;
  color: var(--pink-700);
  background-color: #8f1d5a;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 4px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: min(1000px, 100vw);
  height: min(700px, 100vh);
  height: min(700px, 100dvh);
  border: 4px solid var(--pink-100);
  border-radius: 0;
  overflow: hidden;
  background: #1a0614;
  box-shadow: 0 0 0 4px var(--pink-700), 0 0 0 8px var(--pink-500), 10px 10px 0 rgba(0,0,0,0.45);
}
/* subtle CRT scanlines over everything */
#game-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 3px);
}

#viewport {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  cursor: crosshair;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- HUD */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 5;
}
#hud-top { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#btn-mute { pointer-events: auto; cursor: pointer; }
#btn-mute:hover { transform: translateY(-2px); }
.hud-pill {
  font-family: var(--pixel);
  background: var(--white);
  border: 3px solid var(--pink-500);
  color: var(--pink-700);
  padding: 7px 12px;
  border-radius: 0;
  font-size: 9px;
  line-height: 1.4;
  box-shadow: 3px 3px 0 var(--pink-700);
}
#timer-wrap, #progress-wrap {
  position: relative;
  margin: 8px auto 0;
  width: min(560px, 90%);
  height: 22px;
  background: var(--pink-50);
  border: 3px solid var(--pink-500);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 3px 3px 0 rgba(143,29,90,0.55);
}
#timer-bar {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(90deg, var(--pink-300) 0 6px, var(--pink-400) 6px 12px);
  transition: width 0.2s linear;
}
#timer-bar.danger {
  background: repeating-linear-gradient(90deg, #ff6b6b 0 6px, #ee5253 6px 12px);
  animation: pulse 0.6s steps(2) infinite alternate;
}
#timer-text, #progress-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--pink-700);
  text-shadow: 1px 1px 0 #fff;
}
#progress-wrap { height: 18px; }
#progress-bar {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, #7bed9f 0 6px, #2ed573 6px 12px);
  transition: width 0.3s;
}
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.4); } }

/* ------------------------------------------------------------ Toolbar */
#toolbar {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 10px;
  z-index: 5;
}
.tool-btn {
  font-family: var(--body);
  background: var(--white);
  border: 3px solid var(--pink-200);
  border-radius: 0;
  padding: 6px 14px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  min-width: 108px;
  color: var(--pink-700);
  box-shadow: 3px 3px 0 var(--pink-700);
  transition: transform 0.08s;
}
.tool-btn:hover { transform: translateY(-2px); }
.tool-btn.active {
  border-color: var(--pink-500);
  background: var(--pink-100);
  box-shadow: 3px 3px 0 var(--pink-700), inset 0 0 0 2px var(--white);
}
.tool-emoji { font-size: 22px; line-height: 1.2; filter: contrast(1.1) saturate(1.3); }
.tool-name { font-family: var(--pixel); font-size: 9px; margin-top: 4px; }
.tool-sub { font-size: 15px; opacity: 0.8; }

#hint {
  position: absolute;
  bottom: 112px; left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 3px solid var(--pink-400);
  color: var(--pink-600);
  padding: 5px 12px;
  border-radius: 0;
  font-size: 16px;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--pink-700);
}

#speech {
  position: absolute;
  top: 116px; right: 12px;
  max-width: 220px;
  background: var(--white);
  border: 3px solid var(--pink-500);
  border-radius: 0;
  padding: 8px 10px;
  color: var(--pink-700);
  font-size: 17px;
  line-height: 1.15;
  z-index: 5;
  box-shadow: 4px 4px 0 rgba(143,29,90,0.6);
}

#floating-layer, #toast-layer {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.float-text {
  position: absolute;
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--gold);
  text-shadow: 1px 1px 0 var(--pink-700), 2px 2px 0 var(--pink-700);
  animation: floatUp 0.9s steps(6) forwards;
}
@keyframes floatUp {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-60px); opacity: 0; }
}
.toast {
  position: absolute;
  top: 46%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--pixel);
  font-size: 12px;
  line-height: 1.5;
  background: var(--white);
  border: 4px solid var(--pink-400);
  color: var(--pink-600);
  padding: 14px 22px;
  border-radius: 0;
  box-shadow: 6px 6px 0 var(--pink-700);
  animation: toastPop 1.6s steps(8) forwards;
  white-space: nowrap;
}
@keyframes toastPop {
  0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
  15% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%,-55%) scale(1); opacity: 0; }
}

/* ------------------------------------------------------------- Screens */
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(58, 15, 43, 0.78);
  z-index: 10;
}
.card {
  background: var(--pink-50);
  border: 4px solid var(--pink-500);
  border-radius: 0;
  padding: 24px 28px;
  max-width: 560px;
  width: 92%;
  text-align: center;
  color: var(--pink-700);
  box-shadow: 8px 8px 0 var(--pink-700);
  max-height: 94%;
  overflow-y: auto;
}
.card h1 { font-family: var(--pixel); font-size: 24px; margin: 10px 0; color: var(--pink-500); }
.card h2 { font-family: var(--pixel); font-size: 14px; line-height: 1.5; color: var(--pink-500); margin-bottom: 10px; }
.logo { font-size: 40px; }

/* ---------------------------------------------------------- Storefront */
#storefront { margin-bottom: 8px; }
#store-sign {
  font-family: var(--pixel);
  background: var(--pink-500);
  color: #fff;
  font-size: 11px;
  padding: 10px 8px;
  border-radius: 0;
  border: 3px solid var(--pink-700);
  border-bottom: none;
  text-shadow: 2px 2px 0 var(--pink-700);
}
#awning {
  height: 28px;
  background: repeating-linear-gradient(90deg, #fff 0 20px, var(--pink-400) 20px 40px);
  border: 3px solid var(--pink-700);
  border-radius: 0;
}
#store-body {
  display: flex;
  gap: 8px;
  background: var(--pink-100);
  border: 3px solid var(--pink-700);
  border-top: none;
  border-radius: 0;
  padding: 10px;
}
.store-window {
  flex: 1;
  background: #bfe9ff;
  border: 3px solid #fff;
  border-radius: 0;
  padding: 8px 4px;
  font-size: 15px;
  line-height: 1.1;
  color: var(--pink-700);
  box-shadow: inset 0 0 0 3px var(--pink-300);
}
#store-door {
  flex: 1;
  background: var(--pink-400);
  border: 3px solid #fff;
  border-radius: 0;
  font-size: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
}
#store-door span {
  font-family: var(--pixel);
  background: var(--gold);
  color: var(--pink-700);
  font-size: 8px;
  padding: 3px 6px;
  border-radius: 0;
  border: 2px solid var(--pink-700);
}

/* -------------------------------------------------- Customer intro/outro */
.intro-kicker { font-size: 19px; color: var(--pink-600); }
#intro-name {
  font-family: var(--pixel);
  font-size: clamp(20px, 5vw, 34px);
  line-height: 1.4;
  color: var(--pink-500);
  margin: 10px 0 12px;
  text-shadow: 3px 3px 0 #fff, 4px 4px 0 var(--pink-200);
  animation: namePop 0.4s steps(5);
}
@keyframes namePop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.big-face {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  background: var(--pink-100);
  border: 4px solid var(--pink-500);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--pink-700), inset 0 0 0 4px var(--pink-50);
}
.big-face svg { width: 100%; height: 100%; display: block; }
.speech-line {
  font-size: 20px;
  color: var(--pink-600);
  background: var(--white);
  border: 3px solid var(--pink-300);
  border-radius: 0;
  padding: 10px 12px;
  margin-top: 14px;
}

/* ------------------------------------------- Mini live portrait (play) */
#mini-face {
  position: absolute;
  top: 122px;
  left: 12px;
  width: 76px;
  height: 76px;
  background: var(--pink-100);
  border: 4px solid var(--pink-500);
  border-radius: 0;
  overflow: hidden;
  z-index: 5;
  box-shadow: 4px 4px 0 var(--pink-700);
}
#mini-face svg { width: 100%; height: 100%; display: block; }
.tagline { margin: 12px 0 16px; line-height: 1.3; font-size: 21px; }
.howto {
  background: var(--white);
  border: 3px solid var(--pink-300);
  border-radius: 0;
  padding: 10px 12px;
  margin-bottom: 18px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 19px;
  text-align: left;
  box-shadow: 4px 4px 0 var(--pink-200);
}
.btn-big {
  font-family: var(--pixel);
  background: var(--pink-400);
  color: #fff;
  border: 3px solid #fff;
  font-size: 11px;
  line-height: 1.5;
  padding: 14px 22px;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--pink-700);
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn-big:hover { transform: translate(1px, 1px); box-shadow: 4px 4px 0 var(--pink-700); }
.btn-big:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--pink-700); }
#build-stamp {
  margin-top: 14px;
  font-size: 16px;
  color: var(--pink-600);
  opacity: 0.8;
}

.row { margin-top: 16px; }
.big-score { font-size: 22px; margin-top: 10px; }

/* ---------------------------------------------------------------- Shop */
#shop-items { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
  border: 3px solid var(--pink-200);
  border-radius: 0;
  padding: 8px 10px;
  text-align: left;
  box-shadow: 3px 3px 0 var(--pink-200);
}
.shop-item .emoji { font-size: 24px; }
.shop-item .info { flex: 1; font-size: 17px; line-height: 1.15; }
.shop-item .info b { font-size: 18px; }
.shop-item button {
  font-family: var(--pixel);
  background: var(--pink-500); color: #fff;
  border: 3px solid #fff; border-radius: 0;
  padding: 8px 10px; font-size: 9px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--pink-700);
}
.shop-item button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--pink-700); }
.shop-item button:disabled { background: #b9a7b0; cursor: default; box-shadow: 3px 3px 0 #7c6c74; }
.shop-item.owned { border-color: #2ed573; background: #eafff0; }

/* ------------------------------------------------------ Demands + mirror */
#request-chip {
  background: #fffdf0;
  border-color: var(--gold);
  color: var(--pink-700);
  max-width: 92%;
  white-space: normal;
  text-align: center;
}
#request-chip.done { background: #eafff0; border-color: #2ed573; color: #1e8f4e; }
#btn-mirror { pointer-events: auto; cursor: pointer; }
#btn-mirror:disabled { opacity: 0.5; cursor: default; }
#btn-mirror.ready { border-color: #2ed573; animation: readyPulse 0.7s steps(2) infinite alternate; }
@keyframes readyPulse { from { filter: brightness(1); } to { filter: brightness(1.3); } }

.tool-btn.special { border-color: var(--gold); background: #fffdf0; }
.tool-btn.special.active {
  border-color: #e0a02f;
  background: #fff8e0;
  box-shadow: 3px 3px 0 var(--pink-700), inset 0 0 0 2px var(--gold);
}

.intro-demand {
  font-family: var(--pixel);
  font-size: 9px;
  line-height: 1.7;
  color: var(--pink-600);
  background: var(--white);
  border: 3px solid var(--gold);
  padding: 8px 10px;
  margin: 6px 0 0;
  box-shadow: 4px 4px 0 var(--pink-200);
}

.mirror { margin: 14px auto 4px; width: 150px; animation: mirrorIn 0.4s steps(6); }
@keyframes mirrorIn {
  from { transform: translateY(-26px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.mirror-glass {
  width: 150px;
  height: 108px;
  border: 5px solid var(--gold);
  background: #2a0b1e;
  overflow: hidden;
  box-shadow: inset 0 0 0 4px var(--pink-500), 5px 5px 0 var(--pink-700);
}
.mirror-glass img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.mirror-handle {
  width: 22px;
  height: 28px;
  margin: 0 auto;
  background: var(--gold);
  border: 5px solid var(--pink-700);
  border-top: none;
}
.mirror.liked .mirror-glass { box-shadow: inset 0 0 0 4px #2ed573, 0 0 0 4px #2ed573, 5px 5px 0 var(--pink-700); }
.mirror.disliked .mirror-glass { box-shadow: inset 0 0 0 4px #ff6b6b, 0 0 0 4px #ff6b6b, 5px 5px 0 var(--pink-700); }

.demand-note {
  font-family: var(--pixel);
  font-size: 9px;
  line-height: 1.7;
  margin-top: 10px;
  padding: 8px 10px;
  border: 3px solid;
}
.demand-note.good { color: #1e8f4e; border-color: #2ed573; background: #eafff0; }
.demand-note.bad { color: #c0392b; border-color: #ff6b6b; background: #ffecec; }

/* ------------------------------------------------------ Mobile / small */
@media (max-width: 640px) {
  #game-container { border-radius: 0; border-width: 0; box-shadow: none; width: 100vw; height: 100vh; height: 100dvh; }
  .hud-pill { font-size: 7px; padding: 5px 8px; }
  #timer-wrap, #progress-wrap { width: 94%; }
  #toolbar { gap: 6px; bottom: 8px; width: 100%; justify-content: center; }
  .tool-btn { min-width: 88px; padding: 5px 8px; }
  .tool-emoji { font-size: 18px; }
  .tool-name { font-size: 8px; }
  .tool-sub { font-size: 13px; }
  #hint {
    white-space: normal;
    text-align: center;
    width: 92%;
    font-size: 14px;
    bottom: 132px;
  }
  #mini-face { width: 56px; height: 56px; top: 150px; left: 8px; }
  #speech {
    top: auto;
    bottom: 200px;
    right: 8px;
    max-width: 170px;
    font-size: 15px;
  }
  .card { padding: 16px 14px; }
  .card h1 { font-size: 18px; }
  .big-face { width: 140px; height: 140px; }
  .toast { font-size: 10px; padding: 10px 14px; white-space: normal; text-align: center; max-width: 90%; }
  .btn-big { font-size: 9px; padding: 12px 16px; }
}

/* ------------------------------------- Short landscape (phone sideways) */
@media (max-height: 500px) {
  #hud { padding: 4px 8px; }
  #hud-top { gap: 6px; }
  .hud-pill { font-size: 7px; padding: 4px 8px; }
  #timer-wrap { height: 14px; margin-top: 4px; width: min(420px, 70%); }
  #progress-wrap { height: 12px; margin-top: 4px; width: min(420px, 70%); }
  #timer-text, #progress-text { font-size: 6px; }
  #toolbar { bottom: 4px; gap: 6px; }
  .tool-btn { min-width: 76px; padding: 3px 8px; }
  .tool-emoji { font-size: 16px; }
  .tool-name { font-size: 7px; margin-top: 2px; }
  .tool-sub { display: none; }
  #hint { display: none; }
  #mini-face { width: 46px; height: 46px; top: 96px; left: 8px; }
  #speech { top: auto; bottom: 120px; right: 8px; max-width: 170px; font-size: 14px; padding: 6px 8px; }
  .card { padding: 12px 16px; }
  .card h1 { font-size: 16px; margin: 4px 0; }
  .card h2 { font-size: 11px; }
  .tagline { margin: 4px 0 8px; font-size: 17px; }
  .howto { margin-bottom: 8px; padding: 6px; font-size: 16px; gap: 2px; }
  .btn-big { font-size: 8px; padding: 9px 16px; }
  #build-stamp { margin-top: 6px; font-size: 13px; }
  .big-face { width: 100px; height: 100px; }
  .intro-kicker { font-size: 15px; }
  .speech-line { font-size: 16px; padding: 6px 8px; margin-top: 8px; }
  #store-door { font-size: 20px; }
}
