/* Pokegatchi PoC — the page stays quiet; the shell carries the character. */

:root {
  --page-bg-1: #191b20;
  --page-bg-2: #101216;
  --shell-1: #f2e9df;
  --shell-2: #d9cbbd;
  --shell-edge: #b8a794;
  --bezel: #2a2723;
  --text-dim: #7c8390;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(120% 90% at 50% 0%, var(--page-bg-1), var(--page-bg-2));
  color: var(--text-dim);
  font-family: ui-monospace, Consolas, "Cascadia Mono", monospace;
  display: grid;
  place-items: center;
}

.stage {
  display: flex;
  gap: 3rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 2rem 1rem;
}

.device-wrap { text-align: center; }

/* ---------------- the handheld shell ---------------- */
.shell {
  position: relative;
  width: 330px;
  margin-inline: auto;   /* block box: text-align on the wrap can't center it */
  padding: 20px 22px 26px;
  border-radius: 90px 90px 110px 110px / 70px 70px 130px 130px;
  background:
    linear-gradient(160deg, var(--shell-1) 0%, var(--shell-2) 62%, #cbbaa8 100%);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.75),
    inset 0 -10px 18px rgba(120,95,70,.28),
    inset 3px 0 6px rgba(255,255,255,.35),
    0 18px 40px rgba(0,0,0,.55),
    0 4px 10px rgba(0,0,0,.4);
  user-select: none;
}
.shell.shake-1 { animation: shake-1 .4s; }
.shell.shake-2 { animation: shake-2 .6s; }
.shell.shake-3 { animation: shake-3 .9s; }
@keyframes shake-1 {
  25% { transform: translateX(-2px); } 75% { transform: translateX(2px); }
}
@keyframes shake-2 {
  20% { transform: translate(-3px,1px) rotate(-.6deg); }
  40% { transform: translate(3px,-1px) rotate(.6deg); }
  60% { transform: translate(-3px,1px) rotate(-.6deg); }
  80% { transform: translate(3px,-1px) rotate(.6deg); }
}
@keyframes shake-3 {
  15% { transform: translate(-5px,2px) rotate(-1.2deg); }
  30% { transform: translate(5px,-2px) rotate(1.2deg); }
  45% { transform: translate(-5px,2px) rotate(-1.2deg); }
  60% { transform: translate(5px,-2px) rotate(1.2deg); }
  75% { transform: translate(-3px,1px) rotate(-.6deg); }
  90% { transform: translate(3px,-1px) rotate(.6deg); }
}

.shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}
.brand {
  font-size: 11px;
  letter-spacing: .35em;
  color: #97846f;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.speaker { display: flex; gap: 3px; }
.speaker i {
  width: 3px; height: 12px; border-radius: 2px;
  background: #c3b3a1;
  box-shadow: inset 0 1px 2px rgba(90,70,50,.5);
}

/* LED — real hardware justification: celebrations blink it */
.led {
  width: 10px; height: 10px; border-radius: 50%;
  background: #6d6258;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5);
  transition: background .08s, box-shadow .08s;
}
.led.on-amber { background: #ffb347; box-shadow: 0 0 10px 3px rgba(255,179,71,.8); }
.led.on-green { background: #7be08a; box-shadow: 0 0 10px 3px rgba(123,224,138,.8); }
.led.on-cyan  { background: #6fd8e8; box-shadow: 0 0 10px 3px rgba(111,216,232,.8); }
.led.on-pink  { background: #ff7ab8; box-shadow: 0 0 12px 4px rgba(255,122,184,.85); }
.led.on-red   { background: #ff5f5f; box-shadow: 0 0 10px 3px rgba(255,95,95,.8); }

/* ---------------- the round screen ---------------- */
.screen-bezel {
  width: 276px; height: 276px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #3d3833, var(--bezel) 58%, #171512);
  box-shadow:
    inset 0 4px 10px rgba(0,0,0,.85),
    0 2px 3px rgba(255,255,255,.5),
    0 -1px 2px rgba(90,70,50,.4);
  display: grid;
  place-items: center;
}
.screen-glass {
  position: relative;
  width: 246px; height: 246px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(0,0,0,.9);
}
.screen-glass::after {           /* glossy highlight */
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(80% 45% at 30% 12%, rgba(255,255,255,.16), rgba(255,255,255,0) 60%);
  pointer-events: none;
}
canvas#screen {
  width: 246px; height: 246px;
  border-radius: 50%;
  display: block;
  background: #0d1a12;
  image-rendering: pixelated;
}

/* ---------------- buttons ---------------- */
.buttons {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 20px;
}
.btn-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #6e5c4a;
  background: linear-gradient(170deg, #efe4d7, #d4c3b0);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.8),
    inset 0 -3px 4px rgba(120,95,70,.4),
    0 5px 0 var(--shell-edge),
    0 8px 10px rgba(0,0,0,.35);
  transform: translateY(0);
  transition: transform .06s, box-shadow .06s;
  touch-action: manipulation;
}
.btn-b {
  width: 60px; height: 60px;
  background: linear-gradient(170deg, #ffd9a0, #f0b46a);
  color: #7a5320;
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.8),
    inset 0 -3px 4px rgba(150,100,40,.45),
    0 5px 0 #c08c46,
    0 8px 10px rgba(0,0,0,.35);
}
.btn:active, .btn.pressed {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.6),
    inset 0 -2px 3px rgba(120,95,70,.4),
    0 1px 0 var(--shell-edge),
    0 2px 4px rgba(0,0,0,.3);
}
.btn-b:active, .btn-b.pressed {
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.6),
    inset 0 -2px 3px rgba(150,100,40,.4),
    0 1px 0 #c08c46,
    0 2px 4px rgba(0,0,0,.3);
}
.btn-label { font-size: 10px; color: #9b8a76; letter-spacing: .06em; }

.hint { margin-top: 1.2rem; font-size: 12px; }
kbd {
  background: #23262c; border: 1px solid #33373f; border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-family: inherit; font-size: 11px;
}

/* ---------------- debug time controls (PoC only) ---------------- */
.timectl {
  margin-top: 1rem;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px dashed #3a3f48;
  border-radius: 10px;
  background: rgba(20,22,28,.6);
}
.dbg-title { font-size: 9px; letter-spacing: .3em; color: #5a6472; text-align: left; }
.dbg-row { display: flex; gap: 6px; justify-content: center; }
.timectl button {
  font: inherit; font-size: 11px;
  color: #b9c2cf; background: #20242c;
  border: 1px solid #333842; border-radius: 6px;
  padding: 4px 9px; cursor: pointer;
}
.timectl button:hover { background: #282d37; }
.timectl button.on { background: #2f6fd0; color: #fff; border-color: #2f6fd0; }
.timectl button.danger { color: #ff9f9f; border-color: #5a3138; }
.sensors { margin-top: 8px; }
.sensor-row { flex-wrap: wrap; }
.sensor-row button.on { background: #4a3670; border-color: #8266b3; color: #e6dcff; }

/* ---------------- companion app (phone frame) ---------------- */
.app-wrap { text-align: center; }
.phone {
  width: 300px;
  margin-inline: auto;
  height: 600px;
  border-radius: 40px;
  background: linear-gradient(160deg, #23272e, #14171c);
  padding: 12px;
  box-shadow:
    inset 0 0 0 2px #2f343c,
    inset 0 2px 4px rgba(255,255,255,.08),
    0 18px 40px rgba(0,0,0,.55);
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone-notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 22px; background: #14171c;
  border-radius: 0 0 14px 14px; z-index: 2;
}
.phone-status {
  display: flex; justify-content: space-between;
  padding: 4px 16px 6px; font-size: 10px; color: #6f7f8f;
}
.app-conn { color: #7be08a; }
.phone-screen {
  flex: 1;
  background: #0f1319;
  border-radius: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  text-align: left;
  padding: 12px 14px;
  color: #d7dce2;
}
.phone-screen::-webkit-scrollbar { width: 5px; }
.phone-screen::-webkit-scrollbar-thumb { background: #2a2f38; border-radius: 3px; }
.phone-tabs {
  display: flex;
  border-top: 1px solid #23272e;
  padding-top: 8px;
  margin-top: 8px;
}
.phone-tabs button {
  flex: 1; background: none; border: none; cursor: pointer;
  color: #6f7f8f; font: inherit; font-size: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.phone-tabs button span { font-size: 15px; line-height: 1; }
.phone-tabs button.on { color: #7fd8e8; }
.app-caption { margin-top: 12px; font-size: 11px; color: #5a6472; }

.app-scr h3 { font-size: 13px; color: #c8d2dc; margin-bottom: 10px; }
.app-scr .empty { font-size: 11px; color: #6f7f8f; line-height: 1.6; padding: 20px 4px; }

.status-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.portrait { width: 72px; height: 72px; image-rendering: pixelated; background: #131a15; border-radius: 12px; }
.status-meta { flex: 1; }
.pet-name { font-size: 17px; font-weight: 700; color: #fff; }
.pet-sub { font-size: 10px; color: #8ea3b8; }
.cond-badge { display: inline-block; margin-top: 4px; font-size: 10px; padding: 2px 7px; border-radius: 10px; }
.cond-badge.good { background: rgba(123,224,138,.16); color: #8ee08a; }
.cond-badge.low  { background: rgba(255,165,79,.16); color: #ffa54f; }
.status-flag { font-size: 10px; padding: 4px 8px; border-radius: 6px; margin-bottom: 12px; }
.status-flag.s0 { background: rgba(123,224,138,.12); color: #8ee08a; }
.status-flag.s1 { background: rgba(179,157,219,.14); color: #b39ddb; }
.status-flag.s2 { background: rgba(255,95,95,.16); color: #ff7a7a; }
.status-flag.s3 { background: rgba(150,150,150,.14); color: #9aa4ae; }

.meters { display: flex; flex-direction: column; gap: 7px; }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter-label { width: 62px; font-size: 10px; color: #9fb0c0; text-align: right; }
.meter-track { flex: 1; height: 9px; background: #1c2129; border-radius: 5px; overflow: hidden; }
.meter-track.sm { height: 6px; }
.meter-fill { display: block; height: 100%; border-radius: 5px; transition: width .25s; }
.meter-val { width: 22px; font-size: 9px; color: #7f8b98; text-align: right; }
.xp-wrap { margin-top: 12px; }
.xp-label { font-size: 10px; color: #8ea3b8; margin-bottom: 3px; }

.aff-list { display: flex; flex-direction: column; gap: 6px; }
.aff-row { display: flex; align-items: center; gap: 7px; }
.aff-row.dom .aff-name { color: #ffe066; font-weight: 700; }
.aff-dot { width: 10px; height: 10px; border-radius: 3px; }
.aff-name { width: 66px; font-size: 10px; color: #b9c2cf; }
.aff-foot { margin-top: 12px; font-size: 10px; color: #8ea3b8; line-height: 1.5; }

.cond-explain { font-size: 11px; line-height: 1.6; color: #b9c2cf; }
.cond-explain p { margin-bottom: 8px; }
.cond-explain b { color: #e8eef2; }
.cond-explain .good { color: #8ee08a; } .cond-explain .low { color: #ffa54f; }
.cond-scale { display: flex; align-items: center; gap: 6px; font-size: 9px; color: #7f8b98; margin: 6px 0; }
.cond-bar { flex: 1; height: 8px; background: linear-gradient(90deg, #ffa54f, #8ee08a); border-radius: 5px; position: relative; }
.cond-knob { position: absolute; top: -3px; width: 4px; height: 14px; background: #fff; border-radius: 2px; box-shadow: 0 0 4px rgba(255,255,255,.8); }
.cond-now { font-size: 13px; } .cond-note { color: #8ea3b8; }

.diary-list, .away-list { display: flex; flex-direction: column; gap: 10px; }
.diary-entry { border-left: 2px solid #2f6fd0; padding-left: 9px; }
.diary-day { font-size: 9px; color: #6f7f8f; }
.diary-text { font-size: 11px; color: #d0d7de; line-height: 1.5; }

.away-active { background: rgba(47,111,208,.1); border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.away-badge { font-size: 11px; color: #7fd8e8; }
.away-time { font-size: 14px; color: #fff; margin: 3px 0 6px; }
.away-cap { font-size: 9px; color: #8ea3b8; margin-top: 4px; }
.away-entry { border-left: 2px solid #8ee08a; padding-left: 9px; }
.away-entry-head { font-size: 10px; color: #c8d2dc; }
.away-haul { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.haul-chip { font-size: 9px; background: #1c2129; color: #b9c2cf; padding: 2px 6px; border-radius: 8px; }
.haul-none { font-size: 9px; color: #6f7f8f; }

@media (prefers-reduced-motion: reduce) {
  .shell.shake-1, .shell.shake-2, .shell.shake-3 { animation: none; }
  .btn, .led, .meter-fill { transition: none; }
}

/* stack device + app on narrow screens (phone install) */
@media (max-width: 720px) {
  .stage { flex-direction: column; gap: 1.5rem; padding: 1.25rem 0.5rem; }
  .device-wrap, .app-wrap { width: 100%; }
  .phone { width: 88vw; max-width: 340px; height: 560px; }
}
/* very narrow phones: shrink the shell instead of overflowing */
@media (max-width: 352px) {
  .shell { zoom: 0.92; }
}
