/* Digital Neighborhood: interface styles. The world itself is drawn on the canvas. */
:root {
  --ink: #2b2238;
  --paper: #fffaf0;
  --sun: #ffb020;
  --sky: #4fb3ff;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.1em 0.45em;
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: 7px;
  background: #fff;
  font: 900 0.85em var(--font);
  text-align: center;
}

/* ---------- top bar ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: calc(10px + var(--safe-t)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 5;
}
.hud[hidden] { display: none; }
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.hud-right { display: flex; gap: 6px; align-items: center; pointer-events: auto; }
.title-chip, .objective, .progress, .icon-btn {
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(43, 34, 56, 0.25);
}
.title-chip { padding: 4px 12px; font-weight: 900; font-size: 15px; background: var(--sun); }
.objective {
  max-width: min(440px, 62vw);
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.25;
}
.objective::before { content: '🎯 '; }
.objective.flash { animation: flash 0.6s ease; }
@keyframes flash { 0% { transform: scale(1); } 40% { transform: scale(1.06); background: #fff3c4; } 100% { transform: scale(1); } }
.progress { padding: 5px 12px; font-weight: 900; font-size: 18px; white-space: nowrap; }
.progress small { opacity: 0.6; font-size: 0.75em; }
.progress.done { background: #d6f8df; }
.icon-btn { width: 42px; height: 42px; padding: 0; font-size: 18px; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 34, 56, 0.25); }

/* ---------- prompt, toast ---------- */
.prompt, .toast {
  position: fixed;
  left: 50%;
  z-index: 6;
  padding: 8px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 5px 0 rgba(43, 34, 56, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
/* Door prompt sits under the top bar, clear of the character and the touch buttons */
.prompt { top: calc(100px + var(--safe-t)); transform: translate(-50%, -10px); }
.prompt.show { opacity: 1; transform: translate(-50%, 0); }
.toast { top: calc(150px + var(--safe-t)); transform: translate(-50%, -10px); background: var(--ink); color: #fff; max-width: 92vw; white-space: normal; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- dialogue ---------- */
.dialogue {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  z-index: 7;
  width: min(640px, calc(100vw - 24px));
  min-height: 84px;
  padding: 16px 20px 26px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 8px 0 rgba(43, 34, 56, 0.3);
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;
}
.dialogue.show { opacity: 1; transform: translate(-50%, 0); }
.dialogue p { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.4; }
.dialogue-next { position: absolute; right: 16px; bottom: 6px; font-size: 12px; font-weight: 800; opacity: 0.6; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* ---------- tutorial ---------- */
.tutorial {
  position: fixed;
  top: calc(100px + var(--safe-t));
  right: max(12px, env(safe-area-inset-right));
  z-index: 6;
  width: 240px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(43, 34, 56, 0.25);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s, transform 0.25s;
}
.tutorial.show { opacity: 1; transform: none; }
.tutorial b { display: block; margin-bottom: 8px; font-size: 17px; font-weight: 900; }
.tut-row { margin: 6px 0; font-weight: 800; font-size: 14px; }
.tutorial button {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--sun);
  font-weight: 900;
}

/* ---------- touch controls ---------- */
.touch {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 max(14px, env(safe-area-inset-right)) calc(14px + var(--safe-b)) max(14px, env(safe-area-inset-left));
  pointer-events: none;
}
.touch[hidden] { display: none; }
.touch-act { display: flex; gap: 12px; pointer-events: auto; }
/* Drag joystick: walk in any direction; push to the edge to jog */
.joy {
  position: relative;
  width: 132px;
  height: 132px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.3));
  box-shadow: 0 5px 0 rgba(43, 34, 56, 0.25);
  pointer-events: auto;
  touch-action: none;
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 rgba(43, 34, 56, 0.3);
  transition: transform 0.12s;
}
.joy.down .joy-knob { transition: none; background: #fff3c4; }
.menu .keys-hint { margin: -4px 0 14px; font-size: 14px; font-weight: 800; opacity: 0.8; }
.touch button {
  width: 70px;
  height: 70px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(43, 34, 56, 0.3);
  touch-action: none;
}
.touch button.down { transform: translateY(3px) scale(0.95); box-shadow: 0 2px 0 rgba(43, 34, 56, 0.3); background: #fff3c4; }
.touch .jog { font-size: 15px; background: rgba(255, 214, 102, 0.92); }
.touch .use { background: rgba(126, 220, 140, 0.95); }
body:has(#touch:not([hidden])) .dialogue { bottom: calc(100px + var(--safe-b)); }

/* ---------- menus ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 34, 56, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s;
}
.overlay[hidden] { display: none; }
.overlay.show { opacity: 1; }
.menu {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px 24px;
  border: 4px solid var(--ink);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 10px 0 rgba(43, 34, 56, 0.3);
  text-align: center;
  user-select: text;
}
.menu h1 {
  margin: 4px 0 8px;
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
  background: linear-gradient(90deg, #25d366, #d62976, #1877f2, #ea4335, #ff0000);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.menu h2 { margin: 6px 0 10px; font-size: 26px; font-weight: 900; line-height: 1.15; }
.menu .lead { margin: 0 0 14px; font-size: 16px; font-weight: 700; line-height: 1.45; }
.menu .fine { margin: 0 0 12px; font-size: 13px; opacity: 0.7; }
.logo { font-size: 52px; letter-spacing: 6px; }
.logo span { display: inline-block; animation: hop 1.6s ease-in-out infinite; }
.logo span:last-child { animation-delay: 0.3s; }
@keyframes hop { 50% { transform: translateY(-8px) rotate(-6deg); } }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn {
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(43, 34, 56, 0.3);
  transition: transform 0.08s;
}
.btn small { display: block; font-size: 12px; font-weight: 700; opacity: 0.65; }
.btn.primary { background: var(--sun); }
.btn:hover, .btn:focus-visible { transform: translateY(-2px); outline: none; background: #fff3c4; }
.btn.primary:hover, .btn.primary:focus-visible { background: #ffc54d; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 34, 56, 0.3); }
.confetti { height: 60px; position: relative; }
.confetti span {
  position: absolute;
  left: calc(8% + var(--k) * 12%);
  top: 10px;
  font-size: 30px;
  animation: pop 1.4s calc(var(--k) * 0.08s) ease-in-out infinite alternate;
}
@keyframes pop { from { transform: translateY(14px) rotate(-12deg); } to { transform: translateY(-6px) rotate(12deg); } }

.fade { position: fixed; inset: 0; z-index: 20; background: #1a1424; opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.fade.on { opacity: 1; }

/* ---------- inside an app house ---------- */
.panel-wrap {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(8px + var(--safe-t)) 10px calc(8px + var(--safe-b));
  background: rgba(43, 34, 56, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.22s;
}
.panel-wrap[hidden] { display: none; }
.panel-wrap.show { opacity: 1; }
.panel-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; max-height: 760px; width: min(420px, 100%); }
.panel-banner { padding: 5px 14px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 800; font-size: 14px; }
.panel-hint { font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.app {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 5px solid var(--ink);
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 12px 0 rgba(43, 34, 56, 0.35);
  user-select: text;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.22s;
}
.panel-wrap.show .app { transform: none; }
.app-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 900; font-size: 20px; }
.app-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 18px; }
.app-title { flex: 1; }
.app-close { width: 34px; height: 34px; border: 3px solid currentColor; border-radius: 50%; background: transparent; font-weight: 900; font-size: 15px; }
.app-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.app-body button { border: 0; background: none; text-align: left; }
.avatar { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; font-size: 22px; font-weight: 900; color: #fff; }
.avatar.sm { width: 36px; height: 36px; font-size: 16px; }
.link { color: inherit; font-weight: 900; padding: 6px 4px; }
.empty { padding: 30px; text-align: center; font-weight: 800; opacity: 0.6; }

/* WhatsApp */
.app-whatsapp .app-bar { background: #128c7e; color: #fff; }
.app-whatsapp .app-icon { background: #25d366; }
.wa-tabs { display: flex; background: #128c7e; color: rgba(255, 255, 255, 0.7); font-weight: 900; font-size: 14px; }
.wa-tabs span { flex: 1; padding: 8px; text-align: center; }
.wa-tabs .on { color: #fff; border-bottom: 3px solid #fff; }
.wa-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-bottom: 1px solid #eee !important; }
.wa-row:hover { background: #f5f5f5 !important; }
.wa-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-main small, .wa-side small { color: #667781; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wa-side .hot { color: #25d366; }
.count { min-width: 22px; padding: 1px 6px; border-radius: 999px; background: #25d366; color: #fff; font-size: 12px; font-weight: 900; text-align: center; }
.wa-chathead { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f0f2f5; }
.wa-chathead small { display: block; color: #667781; font-size: 12px; }
.wa-msgs { min-height: 240px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #efeae2 radial-gradient(#e2dccf 1px, transparent 1px) 0 0 / 16px 16px; }
.bubble { max-width: 80%; padding: 7px 10px 6px; border-radius: 12px; font-size: 15px; font-weight: 600; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); animation: msg 0.2s ease; }
.bubble small { margin-left: 8px; color: #53bdeb; font-size: 11px; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.bubble.typing { display: flex; gap: 4px; padding: 12px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: #999; animation: dot 1s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 50% { transform: translateY(-4px); } }
@keyframes msg { from { transform: scale(0.9); opacity: 0; } }
.wa-quick { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; background: #f0f2f5; }
.wa-quick button { padding: 7px 12px !important; border-radius: 999px !important; background: #fff !important; border: 2px solid #25d366 !important; font-weight: 800; font-size: 14px; }

/* Instagram */
.app-instagram .app-bar { background: #fff; border-bottom: 1px solid #eee; }
.app-instagram .app-title { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 26px; font-weight: 400; }
.app-instagram .app-icon { background: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf); color: #fff; }
.ig-stories { display: flex; gap: 12px; padding: 12px; overflow-x: auto; border-bottom: 1px solid #eee; }
.story { display: flex !important; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.story span { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; font-size: 26px; background: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 5px #d62976; }
.story.mine span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ccc; }
.story.seen span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #c7c7c7; }
.story small { font-size: 11px; font-weight: 700; }
.ig-post { border-bottom: 1px solid #eee; padding-bottom: 8px; }
.ig-post header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ig-post header small { display: block; font-size: 12px; color: #737373; }
.avatar.ring { background: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #d62976; color: inherit; }
.ig-img { position: relative; display: grid; place-items: center; aspect-ratio: 1; font-size: 110px; cursor: pointer; }
.ig-img .burst { position: absolute; font-size: 90px; font-style: normal; opacity: 0; pointer-events: none; }
.ig-img .burst.pop { animation: burst 0.7s ease; }
@keyframes burst { 20% { opacity: 1; transform: scale(1.2); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
.ig-actions { display: flex; gap: 6px; padding: 6px 8px 0; }
.ig-actions button { font-size: 24px; padding: 4px !important; }
.ig-actions button:active { transform: scale(1.25); }
.ig-actions .save { margin-left: auto; }
.ig-likes, .ig-cap, .ig-comments p { margin: 2px 12px; font-size: 14px; }
.ig-comments { color: #555; }

/* Facebook */
.app-facebook .app-bar { background: #fff; color: #1877f2; border-bottom: 1px solid #e4e6eb; font-size: 26px; letter-spacing: -1px; }
.app-facebook .app-icon { background: #1877f2; color: #fff; font-family: Arial, sans-serif; font-size: 22px; }
.app-facebook .app-body { background: #f0f2f5; }
.fb-composer, .fb-reply { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: #fff; margin-bottom: 8px; }
.fb-composer input, .fb-reply input, .gm-search input, .gm-reply textarea {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: #f0f2f5;
  font: 700 15px var(--font);
  user-select: text;
}
.fb-composer button, .fb-reply button, .gm-reply button {
  padding: 8px 14px !important;
  border-radius: 10px !important;
  background: #1877f2 !important;
  color: #fff;
  font-weight: 900;
}
.fb-post { margin-bottom: 8px; padding: 10px 0 0; background: #fff; }
.fb-post header { display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.fb-post header small { display: block; font-size: 12px; color: #65676b; }
.fb-post > p { margin: 8px 12px; font-size: 15px; font-weight: 600; }
.fb-img { display: grid; place-items: center; height: 170px; background: linear-gradient(135deg, #e7f0ff, #cfe0ff); font-size: 80px; }
.fb-counts { display: flex; justify-content: space-between; padding: 6px 12px; font-size: 13px; color: #65676b; font-weight: 700; }
.fb-actions { display: flex; border-top: 1px solid #e4e6eb; }
.fb-actions button { flex: 1; padding: 9px 0 !important; text-align: center !important; font-weight: 800; color: #65676b; }
.fb-actions button.on { color: #1877f2; }
.fb-actions button:hover { background: #f2f2f2 !important; }
.fb-comments { padding: 4px 12px 8px; background: #fff; }
.fb-comments p { margin: 6px 0; padding: 6px 10px; border-radius: 14px; background: #f0f2f5; font-size: 14px; }
.fb-reply { padding: 6px 0 0; margin: 0; }

/* Gmail */
.app-gmail .app-bar { background: #fff; color: #5f6368; border-bottom: 1px solid #eee; }
.app-gmail .app-icon { background: #fff; box-shadow: inset 0 0 0 2px #ea4335; }
.gm-search { padding: 10px 12px; }
.gm-search input { width: 100%; background: #eaf1fb; }
.gm-label { padding: 2px 16px 6px; font-size: 12px; font-weight: 900; color: #5f6368; text-transform: uppercase; }
.gm-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f1f1f1; }
.gm-row:hover { background: #f6f8fc; }
.gm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; color: #5f6368; }
.gm-main b, .gm-main span, .gm-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-row.unread .gm-main b, .gm-row.unread .gm-main span { color: #202124; font-weight: 900; }
.gm-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: #5f6368; }
.star { font-size: 20px; padding: 0 !important; }
.gm-tools { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 8px 12px; background: #fff; border-bottom: 1px solid #f1f1f1; }
.gm-tools button { font-size: 20px; padding: 4px 8px !important; }
.gm-tools .link { font-size: 15px; }
.gm-subject { margin: 12px 14px 8px; font-size: 20px; }
.gm-from { display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.gm-from small { display: block; color: #5f6368; font-size: 12px; }
.gm-body { padding: 4px 14px; font-size: 15px; font-weight: 600; line-height: 1.5; }
.gm-sent { padding: 8px 10px; border-left: 4px solid #1a73e8; background: #eaf1fb; border-radius: 6px; }
.gm-reply { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px 14px; }
.gm-reply textarea { height: 60px; border-radius: 14px; resize: none; }
.gm-reply button { background: #1a73e8 !important; }

/* YouTube */
.app-youtube .app-bar { background: #fff; border-bottom: 1px solid #eee; letter-spacing: -1px; }
.app-youtube .app-icon { width: 38px; height: 26px; border-radius: 8px; background: #ff0000; color: #fff; font-size: 12px; }
.yt-chips { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; }
.yt-chips button { flex: none; padding: 6px 12px !important; border-radius: 8px !important; background: #f2f2f2 !important; font-weight: 800; font-size: 14px; }
.yt-chips button.on { background: #0f0f0f !important; color: #fff; }
.yt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 0 12px 12px; }
.yt-card { display: flex !important; flex-direction: column; gap: 6px; }
.yt-thumb { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; font-size: 44px; }
.yt-thumb small { position: absolute; right: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.8); color: #fff; font-size: 11px; font-weight: 800; }
.yt-thumb.sm { width: 110px; flex: none; font-size: 26px; border-radius: 8px; }
.yt-meta b { display: block; font-size: 14px; line-height: 1.25; }
.yt-meta small { color: #606060; font-size: 12px; font-weight: 700; }
.yt-back { display: block; padding: 8px 12px !important; }
.yt-player { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; margin: 0 0 8px; }
.yt-big { font-size: 90px; animation: float 3s ease-in-out infinite; }
.yt-player.paused .yt-big { animation-play-state: paused; filter: grayscale(0.4); }
@keyframes float { 50% { transform: translateY(-8px) scale(1.04); } }
.yt-play { position: absolute; left: 12px; bottom: 18px; width: 40px; height: 40px; border-radius: 50% !important; background: rgba(0, 0, 0, 0.6) !important; color: #fff; text-align: center !important; font-size: 16px; }
.yt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(255, 255, 255, 0.45); cursor: pointer; }
.yt-bar i { display: block; height: 100%; width: 0; background: #ff0000; }
.yt-time { position: absolute; right: 10px; bottom: 16px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-weight: 800; font-size: 12px; }
.yt-title { margin: 4px 12px 8px; font-size: 18px; line-height: 1.25; }
.yt-row { display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.yt-row small { display: block; color: #606060; font-size: 12px; }
.yt-row > span:nth-child(2) { flex: 1; }
.yt-sub { padding: 7px 14px !important; border-radius: 999px !important; background: #0f0f0f !important; color: #fff; font-weight: 900; font-size: 14px; }
.yt-sub.on { background: #f2f2f2 !important; color: #0f0f0f; }
.yt-actions { display: flex; gap: 8px; padding: 10px 12px; }
.yt-actions button { padding: 7px 14px !important; border-radius: 999px !important; background: #f2f2f2 !important; font-weight: 900; }
.yt-actions button.on { background: #0f0f0f !important; color: #fff; }
.yt-next { padding: 4px 12px 14px; }
.yt-next > b { display: block; margin: 4px 0 8px; }
.yt-small { display: flex !important; gap: 10px; width: 100%; margin-bottom: 10px; }
.yt-small b { display: block; font-size: 13px; line-height: 1.25; }
.yt-small small { color: #606060; font-size: 12px; font-weight: 700; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .title-chip { display: none; }
  .objective { font-size: 13px; max-width: 58vw; }
  .dialogue p { font-size: 16px; }
  .tutorial { top: auto; bottom: calc(110px + var(--safe-b)); right: 50%; transform: translate(50%, 10px); }
  .tutorial.show { transform: translate(50%, 0); }
}
@media (max-height: 460px) {
  .touch button { width: 58px; height: 58px; font-size: 22px; }
  .joy { width: 112px; height: 112px; }
  .joy-knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  body:has(#touch:not([hidden])) .dialogue { bottom: calc(82px + var(--safe-b)); min-height: 0; padding: 10px 16px 20px; }
  .dialogue p { font-size: 15px; }
  .tutorial { top: calc(64px + var(--safe-t)); }
  .panel-banner, .panel-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
