:root {
  --paper: #f4f2eb;
  --paper-bright: #fffef9;
  --ink: #17201c;
  --muted: #707872;
  --red: #ef3e35;
  --red-dark: #bd201d;
  --green: #1c9b5f;
  --green-dark: #0a7041;
  --line: rgba(23, 32, 28, 0.16);
  --shadow: 0 18px 50px rgba(30, 39, 34, 0.14);
  --android-ad-height: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.game,
#world {
  width: 100%;
  height: 100%;
}

.game {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--paper);
}

html.android-ad-reserved .game {
  height: calc(100% - var(--android-ad-height));
  margin-top: var(--android-ad-height);
}

html.android-ad-reserved:not(.android-ad-active) .game::before {
  position: absolute;
  z-index: 100;
  top: calc(-1 * var(--android-ad-height));
  right: 0;
  left: 0;
  display: grid;
  height: var(--android-ad-height);
  place-items: center;
  background: #fffef9;
  color: var(--muted);
  content: "광고 준비 중";
  font-size: 10px;
  font-weight: 700;
}

#world {
  display: block;
  cursor: default;
  touch-action: none;
}

.is-hidden {
  display: none !important;
}

.green { color: var(--green); }
.red { color: var(--red); }

.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud__brand {
  position: absolute;
  top: max(26px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  display: flex;
  gap: 7px;
  align-items: baseline;
  padding: 10px 16px 11px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.91);
  box-shadow: 5px 5px 0 var(--ink);
  font-family: "Arial Black", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: clamp(18px, 2vw, 27px);
  letter-spacing: -0.06em;
}

.hud__status {
  position: absolute;
  top: max(28px, env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
}

.status-card {
  min-height: 62px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 254, 249, 0.92);
  box-shadow: 0 9px 24px rgba(23, 32, 28, 0.09);
  backdrop-filter: blur(8px);
}

.status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.lives {
  display: flex;
  gap: 4px;
}

.heart {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--red);
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(189, 32, 29, 0.18));
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.heart.is-empty {
  color: #d8d6cf;
  filter: none;
  opacity: 0.65;
  transform: scale(0.86);
}

.press-card {
  min-width: 83px;
  text-align: center;
}

.press-card strong {
  display: block;
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1;
}

.best-card strong {
  display: block;
  color: var(--red-dark);
  font-size: 22px;
  line-height: 1;
}

.hud-button {
  position: absolute;
  top: max(28px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 254, 249, 0.92);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  pointer-events: auto;
  transform: translateX(-50%);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.hud-button:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(calc(-50% + 3px), 3px);
}

.dash-card {
  position: absolute;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto 118px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 254, 249, 0.92);
  box-shadow: 0 8px 26px rgba(23, 32, 28, 0.1);
  font-size: 11px;
  font-weight: 800;
}

.dash-card kbd,
.guide kbd {
  padding: 4px 7px;
  border: 1px solid #b8bbb7;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  font: 700 10px/1 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
}

.dash-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ddded9;
}

.dash-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #54cf83);
  transform-origin: left center;
}

.inventory {
  position: absolute;
  left: max(28px, env(safe-area-inset-left));
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  max-width: min(520px, 50vw);
  flex-wrap: wrap-reverse;
  gap: 7px;
}

.inventory-item {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid rgba(10, 112, 65, 0.2);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.93);
  box-shadow: 0 5px 18px rgba(23, 32, 28, 0.08);
  font-size: 11px;
  font-weight: 800;
}

.inventory-item b {
  color: var(--green-dark);
}

.guide {
  position: absolute;
  z-index: 11;
  top: 110px;
  left: max(28px, env(safe-area-inset-left));
  padding: 12px 14px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 254, 249, 0.78);
  color: #525a55;
  pointer-events: none;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  transition: opacity 500ms ease;
}

.guide > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.guide > div + div {
  margin-top: 7px;
}

.mouse-icon {
  position: relative;
  width: 16px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.mouse-icon::before {
  position: absolute;
  top: 0;
  bottom: 7px;
  left: 50%;
  width: 1px;
  content: "";
  background: var(--ink);
}

.interaction-hint {
  position: absolute;
  z-index: 12;
  bottom: max(94px, calc(env(safe-area-inset-bottom) + 70px));
  left: 50%;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 249, 0.94);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 800;
  transform: translateX(-50%);
  pointer-events: none;
}

.hint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(239, 62, 53, 0.14);
  animation: pulse-dot 900ms ease-in-out infinite alternate;
}

.toast-stack {
  position: absolute;
  z-index: 20;
  top: 104px;
  left: 50%;
  display: grid;
  width: min(430px, calc(100% - 30px));
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 11px;
  align-items: center;
  padding: 11px 14px 11px 10px;
  border: 1px solid rgba(23, 32, 28, 0.14);
  border-radius: 10px;
  background: rgba(255, 254, 249, 0.96);
  box-shadow: var(--shadow);
  animation: toast-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast.is-leaving {
  animation: toast-out 220ms ease both;
}

.toast__icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #e9f6ee;
  font-size: 21px;
}

.toast--penalty .toast__icon { background: #fde9e6; }
.toast--info .toast__icon { background: #eeeef0; }

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 13px;
}

.toast span {
  color: var(--muted);
  font-size: 11px;
}

.intro,
.title-screen,
.start-screen,
.end-screen,
.pause-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
}

.intro {
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, transparent 49.85%, rgba(23, 32, 28, 0.05) 50%, transparent 50.15%),
    linear-gradient(rgba(23, 32, 28, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 100%, 100% 78px, auto;
}

.intro::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 20%;
  content: "";
  background: linear-gradient(180deg, rgba(201, 199, 189, 0), rgba(165, 164, 154, 0.16));
  clip-path: polygon(0 42%, 100% 0, 100% 100%, 0 100%);
}

.intro__door {
  position: relative;
  width: min(270px, 52vw);
  height: min(55vh, 510px);
  margin-bottom: 12vh;
  border: 8px solid #fff;
  border-bottom: 0;
  background: #faf9f4;
  box-shadow:
    0 0 0 2px rgba(23, 32, 28, 0.12),
    25px 28px 45px rgba(23, 32, 28, 0.13);
}

.intro__door::before {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(23, 32, 28, 0.09);
  content: "";
}

.door-sign {
  position: absolute;
  top: 24%;
  left: 50%;
  width: 74%;
  padding: 15px 10px;
  border: 2px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: 5px 6px 0 var(--red);
  text-align: center;
  transform: translateX(-50%) rotate(-2deg);
}

.door-sign span,
.door-sign small {
  display: block;
}

.door-sign span {
  color: var(--green-dark);
  font-size: clamp(18px, 2.5vw, 27px);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.door-sign small {
  margin-top: 3px;
  color: var(--red-dark);
  font-size: 10px;
  font-weight: 800;
}

.door-knob {
  position: absolute;
  right: 24px;
  top: 53%;
  width: 19px;
  height: 19px;
  border: 4px solid #b0a76e;
  border-radius: 50%;
  background: #e1d277;
  box-shadow: 0 2px 5px rgba(23, 32, 28, 0.24);
}

.narration-card {
  position: absolute;
  z-index: 2;
  right: clamp(18px, 5vw, 74px);
  bottom: clamp(18px, 5vh, 52px);
  left: clamp(18px, 5vw, 74px);
  max-width: 960px;
  margin: auto;
  padding: 20px 24px 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.97);
  box-shadow: 8px 9px 0 var(--ink);
}

.narration-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.narration-speaker { color: var(--green-dark); }

#narration-text {
  min-height: 2.8em;
  margin: 12px 0 17px;
  font-size: clamp(16px, 2.2vw, 23px);
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.035em;
}

.narration-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.text-button,
.primary-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.text-button {
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
}

.primary-button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 10px 17px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--green);
  color: white;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.primary-button:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

.title-screen {
  display: grid;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  background: var(--paper-bright);
}

.title-screen::before,
.title-screen::after {
  position: absolute;
  width: 38vw;
  height: 38vw;
  border-radius: 50%;
  content: "";
  filter: blur(1px);
}

.title-screen::before {
  top: -23vw;
  left: -14vw;
  border: 6vw solid rgba(28, 155, 95, 0.08);
}

.title-screen::after {
  right: -15vw;
  bottom: -24vw;
  border: 6vw solid rgba(239, 62, 53, 0.07);
}

.title-screen h1 {
  position: relative;
  z-index: 1;
  margin: 24px 0 9px;
  font-family: "Arial Black", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: clamp(64px, 13vw, 178px);
  font-weight: 400;
  letter-spacing: -0.09em;
  line-height: 0.9;
  transform-origin: center;
  animation: title-pop 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.title-screen h1 span { color: var(--green); }
.title-screen h1 em { color: var(--red); font-style: normal; }

.title-screen p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: clamp(11px, 1.4vw, 16px);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.title-rule {
  width: min(540px, 70vw);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink), transparent);
  transform: scaleX(0);
  animation: rule-open 900ms 240ms ease forwards;
}

.start-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.96) 0 21%, rgba(244, 242, 235, 0.92) 56%, rgba(225, 224, 216, 0.96) 100%),
    var(--paper);
}

.start-panel,
.end-panel,
.pause-panel {
  width: min(480px, calc(100vw - 32px));
  padding: clamp(26px, 5vw, 48px);
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper-bright);
  box-shadow: 11px 12px 0 var(--ink);
  text-align: center;
}

.eyebrow {
  display: inline-block;
  color: var(--red);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.start-panel h2,
.end-panel h2,
.pause-panel h2 {
  margin: 13px 0 12px;
  font-family: "Arial Black", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: clamp(28px, 5vw, 43px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.055em;
}

.start-panel p,
.end-panel p,
.pause-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}

.start-keys {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  min-height: 104px;
  margin: 18px 0 20px;
}

.touch-start-hint {
  display: none;
}

.key-cluster {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.key-cluster span {
  display: flex;
  gap: 3px;
}

.key-cluster i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #aeb2ae;
  border-bottom: 4px solid #939a94;
  border-radius: 5px;
  background: white;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.start-keys b {
  color: var(--muted);
  font-size: 22px;
}

.mouse-demo {
  position: relative;
  width: 43px;
  height: 64px;
  border: 3px solid var(--ink);
  border-radius: 21px;
  background: white;
}

.mouse-demo::before {
  position: absolute;
  top: 0;
  bottom: 37px;
  left: 50%;
  width: 2px;
  content: "";
  background: var(--ink);
}

.mouse-demo span {
  position: absolute;
  top: 10px;
  left: 11px;
  width: 6px;
  height: 11px;
  border-radius: 5px;
  background: var(--red);
  animation: mouse-click 900ms ease-in-out infinite;
}

.primary-button--large {
  width: 100%;
  min-height: 53px;
  font-size: 14px;
}

.end-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 242, 235, 0.89);
  backdrop-filter: blur(10px);
}

.end-panel {
  animation: panel-in 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.end-panel--win { box-shadow: 11px 12px 0 var(--green-dark); }

.end-icon {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 18px auto 5px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  color: white;
  box-shadow: 5px 5px 0 var(--ink);
  font-family: "Arial Black", "Apple SD Gothic Neo", sans-serif;
  font-size: 38px;
}

.end-panel--win .end-icon {
  border-radius: 12px 12px 50% 50%;
  background: #e6c04a;
  color: var(--ink);
  transform: rotate(-5deg);
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 24px 0;
}

.end-stats div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f2ed;
}

.end-stats span,
.end-stats strong { display: block; }

.end-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.end-stats strong {
  margin-top: 3px;
  font-size: 25px;
}

.pause-screen {
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  background: rgba(244, 242, 235, 0.9);
  backdrop-filter: blur(12px);
  -webkit-overflow-scrolling: touch;
}

.pause-panel {
  width: min(500px, calc(100vw - 32px));
  padding: clamp(22px, 4vw, 38px);
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper-bright);
  box-shadow: 10px 11px 0 var(--ink);
  text-align: center;
  animation: panel-in 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pause-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0 12px;
}

.pause-stats div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f2ed;
}

.pause-stats span,
.pause-stats strong {
  display: block;
}

.pause-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.pause-stats strong {
  margin-top: 2px;
  font-size: 23px;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.setting-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.setting-row span,
.setting-row b,
.setting-row small {
  display: block;
}

.setting-row > strong {
  color: var(--green-dark);
  font-size: 24px;
  line-height: 1;
}

.setting-row b {
  font-size: 13px;
}

.setting-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.switch {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #c9cbc5;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(23, 32, 28, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.switch.is-on {
  background: var(--green);
}

.switch.is-on::after {
  transform: translateX(18px);
}

.pause-restart {
  margin-top: 8px;
}

.privacy-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}

.privacy-details summary {
  padding: 13px 3px 5px;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.privacy-details div {
  padding: 8px 4px 0;
}

.privacy-details p {
  margin: 0 0 7px;
  font-size: 10px;
  line-height: 1.65;
}

.privacy-details a {
  display: inline-block;
  margin: 2px 10px 0 0;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 800;
}

.android-privacy-details {
  display: none;
}

html.android-ad-shell .privacy-details:not(.android-privacy-details) {
  display: none;
}

html.android-ad-shell .android-privacy-details {
  display: block;
}

.touch-controls {
  position: absolute;
  z-index: 30;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.touch-pad {
  position: relative;
  width: 132px;
  height: 132px;
  pointer-events: auto;
}

.touch-pad button {
  position: absolute;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(23, 32, 28, 0.25);
  border-radius: 10px;
  background: rgba(255, 254, 249, 0.82);
  color: var(--ink);
}

.touch-pad [data-direction="up"] { top: 0; left: 44px; }
.touch-pad [data-direction="left"] { top: 44px; left: 0; }
.touch-pad [data-direction="down"] { top: 44px; left: 44px; }
.touch-pad [data-direction="right"] { top: 44px; left: 88px; }

.touch-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-actions button {
  width: 64px;
  height: 64px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.touch-interact { background: var(--red); }
.touch-dash { background: var(--green); }

@keyframes title-pop {
  from { opacity: 0; transform: scale(0.5) rotate(-2deg); }
  65% { opacity: 1; transform: scale(1.06) rotate(0.5deg); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes rule-open { to { transform: scaleX(1); } }
@keyframes mouse-click { 50% { transform: translateY(4px); opacity: 0.55; } }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(25px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse-dot { to { transform: scale(1.25); } }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(0.96); } }

@media (pointer: coarse), (max-width: 720px) {
  .touch-controls:not(.is-hidden) { display: flex; }
  .guide,
  .dash-card,
  .inventory { display: none; }

  .hud__brand {
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    padding: 7px 11px 8px;
    box-shadow: 3px 3px 0 var(--ink);
    font-size: 17px;
  }

  .hud__status {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }

  .status-card {
    min-height: 51px;
    padding: 7px 9px;
  }

  .press-card { min-width: 58px; }
  .press-card strong { font-size: 17px; }
  .best-card strong { font-size: 17px; }

  .hud-button {
    top: max(16px, env(safe-area-inset-top));
    width: 40px;
    height: 40px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .heart {
    width: 15px;
    height: 20px;
    font-size: 16px;
  }

  .interaction-hint { bottom: 157px; }
  .toast-stack { top: 76px; }
  .narration-card { padding: 16px; }
  .narration-actions { justify-content: space-between; }
}

@media (max-height: 620px) {
  .intro__door {
    height: 44vh;
    margin-bottom: 25vh;
  }

  .narration-card { bottom: 12px; }

  #narration-text {
    min-height: 0;
    margin: 8px 0;
  }

  .start-panel,
  .end-panel { padding: 20px 30px; }

  .start-keys {
    display: none;
  }

  .touch-start-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 62px;
    margin: 8px 0 12px;
  }

  .touch-start-hint span {
    min-width: 98px;
    padding: 10px 12px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    background: white;
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    line-height: 1.35;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .touch-start-hint span:last-child {
    border-color: var(--green);
    box-shadow: 3px 3px 0 var(--green);
  }

  .touch-start-hint b {
    color: var(--ink);
    font-size: 14px;
  }

  .touch-start-hint i {
    color: var(--muted);
    font-size: 18px;
    font-style: normal;
    font-weight: 900;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
