/*
  neo 前略プロフィール
  Wrapped in a ガラケー (flip phone) UI frame.
*/

:root {
  --phone-body: #1a1a2e;
  --phone-body-2: #2a2a3e;
  --phone-bezel: #111122;
  /* Gara-kei monochrome LCD vibes — saturated green, near-black "dots" */
  --screen-bg: #7ea93a;
  --label-bg: #1f2c08;
  --label-text: #c8d889;
  --answer-text: #0e1604;
  --answer-text-2: #1d2a0c;
  --accent-pink: #ff6b9d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: "Noto Sans JP", "Inter", -apple-system, sans-serif;
  /* City-pop / cyberpunk: deep saturated blue → warm cream gradient,
     overlaid with SVG film grain for paper-like texture.
     ── Tune knobs ──
     • Colors:        the linear-gradient stops below
     • Grain density: baseFrequency in the SVG (higher=finer)
     • Grain strength: opacity at the end of the SVG (0.0–1.0)
  */
  background-color: #334fc7;
  background-image: none;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px 0;
}

.dot { font-family: "DotGothic16", "MS Gothic", sans-serif; }

/* ═══════════════════════════════════════
   PHONE FRAME
   ═══════════════════════════════════════ */
.phone {
  width: 320px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  perspective: 1200px;
  transform-style: preserve-3d;
  position: relative;
}

/* ─── TOP HALF (flip container) ─── */
.phone-top-wrap {
  transform-style: preserve-3d;
  transform-origin: bottom center;
  transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
  position: relative;
  z-index: 2; /* lid sits above keypad in 3D stacking so it can physically cover the bottom half when folded down */
}

.phone.closed .phone-top-wrap {
  transform: rotateX(-180deg);
}

/* Lower half is always physically present at full size — the rotating lid covers it when closed,
   and as the lid lifts, the keypad is gradually revealed (just like a real flip phone). */
.phone-hinge,
.phone-bottom {
  position: relative;
  z-index: 1;
}

/* Clickable area when closed (whole phone) */
.phone.closed .phone-top-wrap {
  cursor: pointer;
}

/* ─── FRONT FACE (screen side) ─── */
.phone-top {
  background: linear-gradient(170deg, #2a2a42, #1a1a2e 40%, #22223a);
  border-radius: 28px 28px 6px 6px;
  padding: 14px 10px 10px;
  box-shadow:
    0 2px 0 #0a0a16,
    0 8px 32px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  backface-visibility: hidden;
}

/* ─── BACK FACE (closed phone back) ─── */
.phone-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, #2a2a36, #1a1a24 30%, #222230 60%, #1e1e2a);
  border-radius: 6px 6px 28px 28px;
  backface-visibility: hidden;
  transform: rotateX(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  /* When phone is open, back face is hidden — make sure it doesn't steal scroll/click events from the screen */
  pointer-events: none;
  box-shadow:
    0 2px 0 #0a0a16,
    0 8px 32px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.phone.closed .phone-back {
  pointer-events: auto;
}

/* Camera lens — bottom-left corner */
.back-camera {
  position: absolute;
  bottom: 36px;
  left: 36px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #111 40%, #222 50%, #333 60%, #111 70%);
  border: 2px solid #444;
  box-shadow:
    0 0 0 3px #222,
    inset 0 0 8px rgba(0,0,0,0.8);
}

.back-camera::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
}

/* Sub display */
.sub-display {
  width: 80px;
  height: 60px;
  background:
    radial-gradient(ellipse at center, #1a1450 0%, #0a0830 60%, #050218 100%);
  border-radius: 4px;
  border: 1.5px solid #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  /* overflow visible so glow leaks onto the back panel */
  overflow: visible;
  box-shadow:
    /* inner highlight to look like back-lit LCD */
    inset 0 0 14px rgba(140,120,255,0.55),
    inset 0 0 4px rgba(200,180,255,0.4),
    /* outer bloom — multi-layer for the P902i-style spill */
    0 0 12px rgba(120,100,255,0.85),
    0 0 28px rgba(110,90,255,0.7),
    0 0 56px rgba(100,80,255,0.55),
    0 0 90px rgba(90,70,255,0.35);
  animation: sub-bloom 2.6s ease-in-out infinite;
}

/* Outer halo — wide soft glow that paints the surrounding back panel */
.sub-display::before {
  content: "";
  position: absolute;
  inset: -60px;
  background:
    radial-gradient(circle, rgba(130,110,255,0.55) 0%, rgba(110,90,255,0.25) 25%, rgba(100,80,255,0.08) 55%, transparent 75%);
  filter: blur(4px);
  animation: sub-glow 2.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* Scanline / LCD texture overlay inside the panel */
.sub-display::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 1px,
      transparent 1px,
      transparent 2px
    ),
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 40%);
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

@keyframes sub-glow {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

@keyframes sub-bloom {
  0%, 100% {
    box-shadow:
      inset 0 0 14px rgba(140,120,255,0.55),
      inset 0 0 4px rgba(200,180,255,0.4),
      0 0 12px rgba(120,100,255,0.85),
      0 0 28px rgba(110,90,255,0.7),
      0 0 56px rgba(100,80,255,0.55),
      0 0 90px rgba(90,70,255,0.35);
  }
  50% {
    box-shadow:
      inset 0 0 18px rgba(170,150,255,0.7),
      inset 0 0 6px rgba(220,200,255,0.55),
      0 0 18px rgba(140,120,255,1),
      0 0 40px rgba(120,100,255,0.85),
      0 0 80px rgba(110,90,255,0.65),
      0 0 130px rgba(100,80,255,0.45);
  }
}

.sub-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-shadow:
    0 0 4px rgba(255,255,255,0.95),
    0 0 10px rgba(180,160,255,0.95),
    0 0 18px rgba(140,120,255,0.85),
    0 0 28px rgba(120,100,255,0.7);
  position: relative;
  z-index: 3;
}

.sub-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  color: rgba(220,210,255,0.95);
  text-shadow:
    0 0 4px rgba(180,160,255,0.9),
    0 0 8px rgba(140,120,255,0.6);
  position: relative;
  z-index: 3;
}

.sub-mail {
  font-size: 9px;
  color: #fff2b0;
  text-shadow:
    0 0 4px rgba(255,220,120,1),
    0 0 10px rgba(255,180,80,0.9),
    0 0 18px rgba(255,140,60,0.7);
  position: relative;
  z-index: 3;
  animation: mail-pulse-sub 1.4s ease-in-out infinite;
}

@keyframes mail-pulse-sub {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Screws on back */
.back-screw {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #555, #333);
  border: 0.5px solid #222;
  position: absolute;
}

.back-screw.tl { top: 16px; left: 16px; }
.back-screw.tr { top: 16px; right: 16px; }
.back-screw.bl { bottom: 16px; left: 16px; }
.back-screw.br { bottom: 16px; right: 16px; }


/* ─── HINGE ─── */
.phone-hinge {
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.phone-hinge:hover {
  background: linear-gradient(180deg, #1a1a2e, #333340 20%, #3a3a46 50%, #333340 80%, #2a2a34);
}

.hinge-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: "DotGothic16", sans-serif;
  font-size: 8px;
  color: rgba(255,255,255,0);
  transition: color 0.2s;
  white-space: nowrap;
}

.phone-hinge:hover .hinge-label {
  color: rgba(255,255,255,0.4);
}

/* ─── STATUS BAR (ガラケー風) ─── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 8px;
  background: linear-gradient(180deg, #f0f0f0, #d8d8d8);
  border-radius: 3px 3px 0 0;
  margin: 0 2px 2px;
  border-bottom: 1px solid #bbb;
  min-height: 18px;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Antenna icon (ドコモ風ピクト) */
.antenna {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 11px;
}

.antenna span {
  display: block;
  width: 2px;
  background: #333;
}

.antenna span:nth-child(1) { height: 3px; }
.antenna span:nth-child(2) { height: 5px; }
.antenna span:nth-child(3) { height: 8px; }
.antenna span.empty { background: #bbb; }

/* 3G badge */
.badge-3g {
  font-family: "JetBrains Mono", monospace;
  font-size: 7px;
  font-weight: 700;
  color: #555;
  border: 1px solid #999;
  border-radius: 2px;
  padding: 0 2px;
  line-height: 1.3;
}

/* Mail icon */
.status-mail {
  position: relative;
  font-size: 11px;
  line-height: 1;
  color: #d44;
  animation: mail-blink 1.5s step-end infinite;
}

@keyframes mail-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Person icon */
.status-person {
  font-size: 10px;
  line-height: 1;
  color: #666;
}

/* Clock */
.status-clock {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  color: #333;
  letter-spacing: -0.02em;
}

/* Battery (block style) */
.status-battery {
  display: flex;
  align-items: center;
  gap: 0;
}

.battery-body {
  width: 16px;
  height: 9px;
  border: 1.5px solid #444;
  border-radius: 1px;
  padding: 1px;
  display: flex;
  gap: 1px;
}

.battery-body::after {
  content: "";
  position: relative;
  display: block;
  width: 2px;
  height: 4px;
  background: #444;
  border-radius: 0 1px 1px 0;
  margin-left: -1px;
  align-self: center;
}

.battery-block {
  flex: 1;
  background: #4a4;
  border-radius: 0.5px;
}

.battery-block.empty {
  background: transparent;
}

/* ─── SOFT KEYS BAR (画面下) ─── */
.softkey-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #c8a0d8, #a878c0);
  border-radius: 0 0 3px 3px;
  margin: 2px 2px 0;
  padding: 4px 6px;
  border-top: 1px solid #d4b0e0;
}

.softkey {
  font-family: "DotGothic16", sans-serif;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  cursor: default;
  padding: 1px 4px;
}

.softkey-center {
  font-family: "DotGothic16", sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  padding: 1px 10px;
  cursor: default;
}

.softkey .arrow {
  font-size: 8px;
  margin: 0 1px;
}

/* ─── SCREEN ─── */
.screen-stage {
  position: relative;
  height: 360px;
  flex-shrink: 0;
}
.screen {
  background: var(--screen-bg);
  border-radius: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.screen::-webkit-scrollbar {
  width: 4px;
}

.screen::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}

.screen-inner {
  padding: 12px 14px 20px;
}

/* ─── HINGE (base styles, extended above) ─── */
.phone-hinge {
  height: 14px;
  background: linear-gradient(180deg, #1a1a2e, #222230 20%, #2a2a36 50%, #222230 80%, #2a2a34);
  margin: 0 16px;
  position: relative;
  border-left: 1px solid #111;
  border-right: 1px solid #111;
}

/* ─── BOTTOM HALF (keypad side) ─── */
.phone-bottom {
  background: linear-gradient(175deg, #2a2a34, #1c1c26 30%, #303038 60%, #252530);
  border-radius: 6px 6px 28px 28px;
  padding: 14px 16px;
  box-shadow:
    0 4px 0 #0a0a12,
    0 12px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08);
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ─── PHONE BRAND (bottom spacer) ─── */
.phone-brand {
  text-align: center;
  padding: 8px 0 4px;
}

.phone-brand-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.1em;
}

/* ─── KEYPAD AREA ─── */
.keypad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}

/* D-pad zone: 4 corner buttons + circular pad */
.dpad-zone {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  grid-template-rows: 24px 1fr 24px;
  gap: 4px;
  width: 100%;
  max-width: 200px;
}

.corner-btn {
  background: linear-gradient(180deg, #3a3a44, #2a2a34);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.corner-btn .icon {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
}

.corner-btn .lbl {
  font-family: "JetBrains Mono", monospace;
  font-size: 7px;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  display: block;
}

.corner-tl { grid-column: 1; grid-row: 1; flex-direction: column; }
.corner-tr { grid-column: 3; grid-row: 1; flex-direction: column; }
.corner-bl { grid-column: 1; grid-row: 3; flex-direction: column; }
.corner-br { grid-column: 3; grid-row: 3; flex-direction: column; }

/* Circular d-pad */
.dpad-wrap {
  grid-column: 2;
  grid-row: 1 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dpad-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a3a44, #282832);
  border: 1.5px solid rgba(255,255,255,0.1);
  position: relative;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.3),
    0 2px 4px rgba(0,0,0,0.3);
}

.dpad-circle-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #404048, #303038);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Arrows on d-pad */
.dpad-circle::before {
  content: "▲";
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 6px;
  color: rgba(255,255,255,0.2);
}

.dpad-circle::after {
  content: "▼";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 6px;
  color: rgba(255,255,255,0.2);
}

/* Middle row: call, clear, end */
.middle-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
  max-width: 196px;
  margin-top: 4px;
}

.action-btn {
  flex: 1;
  background: linear-gradient(180deg, #3a3a44, #2a2a34);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  padding: 4px 4px;
  text-align: center;
  cursor: default;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.action-btn .icon {
  font-size: 10px;
  display: block;
  line-height: 1;
}

.action-btn .lbl {
  font-family: "DotGothic16", sans-serif;
  font-size: 6px;
  color: rgba(255,255,255,0.3);
  display: block;
  margin-top: 1px;
}

.action-btn.call .icon { color: rgba(100,220,120,0.7); }
.action-btn.clear .icon { font-family: "JetBrains Mono", monospace; font-size: 8px; font-weight: 700; color: rgba(255,255,255,0.4); }
.action-btn.end .icon { color: rgba(220,80,80,0.7); }

/* Numpad */
.numpad-wrap {
  position: relative;
  max-width: 196px;
  width: 100%;
  margin-top: 6px;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.numpad-fade {
  position: absolute;
  bottom: 0;
  left: -16px;
  right: -16px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, #252530);
  pointer-events: none;
  display: none;
}

.num-key {
  background: linear-gradient(180deg, #3a3a44, #2a2a34);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 5px 4px;
  text-align: center;
  cursor: default;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.num-key .num {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  display: block;
}

.num-key .sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 6px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.06em;
  display: block;
  margin-top: 1px;
}

/* ═══════════════════════════════════════
   SCREEN CONTENT (前略プロフ)
   ═══════════════════════════════════════ */

/* ─── MARQUEE ─── */
.marquee-wrap {
  overflow: hidden;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 4px 0;
  margin-bottom: 14px;
}

.marquee {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 14s linear infinite;
  font-family: "DotGothic16", sans-serif;
  font-size: 11px;
  color: #fff;
}

@keyframes marquee {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}

/* ─── HEADER ─── */
.header {
  text-align: center;
  margin-bottom: 14px;
}

.header-stars {
  font-size: 11px;
  color: #fff;
  letter-spacing: 0.4em;
  margin-bottom: 4px;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.header h1 {
  font-family: "DotGothic16", sans-serif;
  font-size: 20px;
  font-weight: 400;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

.header .subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  margin-top: 3px;
}

/* ─── PROFILE IMAGE ─── */
.prof-img-area {
  text-align: center;
  margin: 12px 0 14px;
}

.prof-img-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.prof-img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── COUNTER ─── */
.counter-bar {
  text-align: center;
  margin: 0 0 16px;
  font-family: "DotGothic16", sans-serif;
  font-size: 12px;
  color: #fff;
  line-height: 2;
}

.counter {
  display: inline-block;
  background: #0a0a1a;
  color: #44ff88;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.15em;
  border: 1px solid #222;
  margin: 0 2px;
}

.kiriban {
  display: block;
  font-size: 10px;
  color: var(--accent-pink);
}

/* ─── PROFILE ITEMS ─── */
.prof-item {
  margin-bottom: 2px;
  text-align: center;
}

.prof-label {
  font-family: "DotGothic16", sans-serif;
  font-size: 12px;
  color: var(--label-text);
  background: var(--label-bg);
  padding: 4px 14px;
  border-radius: 3px;
  display: block;
  width: 100%;
  text-align: left;
  text-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

.prof-answer {
  font-size: 13px;
  color: var(--answer-text);
  padding: 5px 14px 10px;
  line-height: 1.6;
  text-align: center;
}

/* ─── DIVIDER ─── */
.divider {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin: 18px 0 12px;
  letter-spacing: 0.3em;
}

/* ─── HITOKOTO ─── */
.hitokoto-box {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--answer-text);
  text-align: center;
  margin-top: 6px;
}

/* ─── LINKS ─── */
.link-section { margin-top: 8px; }

.link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 5px;
  text-decoration: none;
  color: var(--answer-text);
  transition: background 0.15s;
}

.link-item:hover { background: rgba(255,255,255,0.28); }

.link-emoji { font-size: 18px; flex-shrink: 0; }
.link-body { flex: 1; }

.link-name {
  font-family: "DotGothic16", sans-serif;
  font-size: 13px;
}

.link-desc {
  font-size: 10px;
  color: var(--answer-text-2);
  opacity: 0.7;
  margin-top: 1px;
}

.link-arrow {
  color: var(--answer-text-2);
  opacity: 0.3;
  font-size: 13px;
}

/* ─── GUESTBOOK ─── */
.guestbook-box {
  text-align: center;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 16px 12px;
  margin-top: 6px;
}

.gb-title {
  font-family: "DotGothic16", sans-serif;
  font-size: 13px;
  color: var(--answer-text);
}

.gb-sub {
  font-size: 11px;
  color: var(--answer-text-2);
  opacity: 0.7;
  margin: 3px 0 10px;
}

.gb-btn {
  display: inline-block;
  font-family: "DotGothic16", sans-serif;
  font-size: 12px;
  background: var(--label-bg);
  color: #fff;
  padding: 5px 20px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  opacity: 0.6;
}

.gb-note {
  font-family: "DotGothic16", sans-serif;
  font-size: 9px;
  color: var(--answer-text-2);
  opacity: 0.5;
  margin-top: 6px;
}

/* ─── FOOTER ─── */
.screen-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,0.3);
  font-family: "DotGothic16", sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  line-height: 2.2;
}

.neo-badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  color: rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.12);
  padding: 2px 6px;
  border-radius: 2px;
  margin-top: 2px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 360px) {
  body { padding: 12px 4px; }
  .phone { width: 100%; }
  .phone-top { border-radius: 20px 20px 4px 4px; padding: 10px 8px 8px; }
  .screen { height: 340px; }
}

/* ═══════════════════════════════════════════
   v2: ENHANCED INTERACTIONS
   ═══════════════════════════════════════════ */

.phone { position: relative; }

/* ─── Incoming call (initial state) ─── */
/* Rhythmic, restrained "vibrate" pattern: two short bursts then a long pause,
   like a real phone set to a polite vibrate alert. */
.phone.incoming {
  animation: incoming-shake 1.6s ease-in-out infinite;
}
.phone.incoming .sub-display {
  animation: sub-bloom 1.6s ease-in-out infinite;
}
.phone.incoming::after {
  content: "";
  position: absolute;
  inset: -160px;
  background: radial-gradient(ellipse at center, rgba(140,120,255,0.4), rgba(120,100,255,0.15) 40%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: incoming-glow 1.6s ease-in-out infinite;
  border-radius: 50%;
  filter: blur(20px);
}
@keyframes incoming-shake {
  /* First buzz */
  0%   { transform: translate(0, 0) rotate(0deg); }
  3%   { transform: translate(-1.2px, 0.4px) rotate(-0.18deg); }
  6%   { transform: translate(1.2px, -0.4px) rotate(0.18deg); }
  9%   { transform: translate(-1.2px, 0.4px) rotate(-0.15deg); }
  12%  { transform: translate(0, 0) rotate(0deg); }
  /* Brief pause */
  18%  { transform: translate(0, 0) rotate(0deg); }
  /* Second buzz */
  21%  { transform: translate(-1px, 0.3px) rotate(-0.15deg); }
  24%  { transform: translate(1px, -0.3px) rotate(0.15deg); }
  27%  { transform: translate(-1px, 0.3px) rotate(-0.12deg); }
  30%  { transform: translate(0, 0) rotate(0deg); }
  /* Long restful pause until next cycle */
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes incoming-glow {
  /* Glow swells gently with the two buzzes, then rests */
  0%   { opacity: 0.45; transform: scale(1); }
  10%  { opacity: 0.95; transform: scale(1.05); }
  18%  { opacity: 0.55; transform: scale(1.01); }
  26%  { opacity: 0.9;  transform: scale(1.04); }
  35%  { opacity: 0.5;  transform: scale(1); }
  100% { opacity: 0.45; transform: scale(1); }
}

/* "Tap to answer" hint shown only during incoming — JS positions it above the closed phone face */
.press-hint {
  position: fixed;
  top: 0;
  left: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  letter-spacing: 0.05em;
  font-family: "DotGothic16", "MS Gothic", sans-serif;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  animation: hint-in 0.4s ease-out 0.6s forwards, hint-fade 1.6s ease-in-out 1s infinite;
  white-space: nowrap;
}
.press-hint.hide { animation: hint-out 0.3s ease-out forwards; }
@keyframes hint-in   { to { opacity: 1; } }
@keyframes hint-out  { to { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); } }
@keyframes hint-fade { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ─── i-mode style menu overlay ─── */
.imode-menu {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffe4f0 0%, #d4f0ff 100%);
  display: none;
  flex-direction: column;
  z-index: 30;
  border-radius: 4px;
  overflow: hidden;
}
.imode-menu.show { display: flex; animation: menu-in 0.22s ease-out; }
@keyframes menu-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.imode-header {
  background: linear-gradient(180deg, #ff5588 0%, #cc3366 100%);
  color: #fff;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.3);
  flex-shrink: 0;
  border-bottom: 1px solid #88224d;
}
.imode-header .imark {
  background: #fff;
  color: #cc3366;
  font-style: italic;
  font-weight: 900;
  font-family: Georgia, "Times New Roman", serif;
  padding: 0 5px 1px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1;
}
.imode-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
}
.imode-cell {
  background: #fff;
  border: 1.5px solid #ffaacc;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
  text-decoration: none;
  color: #333;
  position: relative;
  min-width: 0;
}
.imode-cell:hover { background: #fff5fa; transform: translateY(-1px); }
.imode-cell.active {
  background: #ffeef5;
  border-color: #ff5588;
  box-shadow: 0 0 0 2px #ffcc44, 0 0 12px rgba(255,200,100,0.55);
  animation: cell-blink 0.45s ease-in-out infinite alternate;
}
.imode-cell.disabled { opacity: 0.45; cursor: not-allowed; }
@keyframes cell-blink {
  from { box-shadow: 0 0 0 2px #ffcc44, 0 0 8px rgba(255,200,100,0.35); }
  to   { box-shadow: 0 0 0 2px #ff8800, 0 0 18px rgba(255,150,50,0.7); }
}
.imode-icon {
  font-size: 22px;
  line-height: 1;
}
.imode-label {
  font-size: 8.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
  margin-top: 3px;
  color: #663355;
  letter-spacing: -0.02em;
}
.imode-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 8px;
  color: #c08;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  background: rgba(255,255,255,0.7);
  padding: 0 3px;
  border-radius: 2px;
}
.imode-footer {
  background: #2a1a2a;
  color: #fff;
  padding: 4px 8px;
  font-size: 9px;
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  flex-shrink: 0;
  letter-spacing: 0.05em;
  border-top: 1px solid #000;
}
.imode-footer .left  { color: #66ddff; }
.imode-footer .right { color: #ffcc66; }

/* Toast for placeholder menu items */
.imode-toast {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 6px 12px;
  font-size: 10px;
  border-radius: 12px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  font-family: "Noto Sans JP", sans-serif;
}
.imode-toast.show {
  animation: toast-in 1.6s ease forwards;
}
@keyframes toast-in {
  0%   { opacity: 0; transform: translate(-50%, 8px); }
  15%  { opacity: 1; transform: translate(-50%, 0); }
  80%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

/* ─── Number ghost when typing on numpad ─── */
.num-ghost-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
  border-radius: 4px;
}
.num-ghost {
  position: absolute;
  font-family: "JetBrains Mono", monospace;
  font-size: 90px;
  font-weight: 700;
  color: rgba(255,80,140,0.5);
  top: 50%;
  left: 50%;
  text-shadow:
    0 0 24px rgba(255,80,140,0.85),
    0 0 60px rgba(255,80,140,0.45);
  animation: ghost-fade 0.7s ease-out forwards;
}
@keyframes ghost-fade {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-8deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4) rotate(4deg); }
}

/* ─── Key press feedback ─── */
.num-key.pressed,
.action-btn.pressed,
.corner-btn.pressed {
  transform: translateY(1px) scale(0.97) !important;
  filter: brightness(0.85);
}
.dpad-circle.pressed-up    { box-shadow: inset 0 6px 10px rgba(0,0,0,0.55); }
.dpad-circle.pressed-down  { box-shadow: inset 0 -6px 10px rgba(0,0,0,0.55); }
.dpad-circle.pressed-left  { box-shadow: inset 6px 0 10px rgba(0,0,0,0.55); }
.dpad-circle.pressed-right { box-shadow: inset -6px 0 10px rgba(0,0,0,0.55); }
.dpad-circle-center.pressed { transform: translate(-50%, -50%) scale(0.92); filter: brightness(0.85); }

/* Scroll highlight indicator (shows currently focused question) */
.prof-item.focused {
  background: rgba(255, 200, 60, 0.2);
  outline: 1.5px solid rgba(255, 150, 0, 0.5);
  outline-offset: -1px;
  border-radius: 3px;
  transition: background 0.15s, outline 0.15s;
}

/* ─── Realistic phone-back details ─── */

/* Hinge spine at top of closed phone (suggests fold) */
.back-hinge-spine {
  position: absolute;
  top: -6px;
  left: 22px;
  right: 22px;
  height: 8px;
  background: linear-gradient(180deg, #0a0a14 0%, #1a1a24 50%, #2a2a34 100%);
  border-radius: 4px 4px 1px 1px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 -1px 2px rgba(0,0,0,0.4);
}
.back-hinge-spine::before,
.back-hinge-spine::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 18px;
  height: 6px;
  background: radial-gradient(ellipse at center, #2a2a34 30%, #0a0a14 80%);
  border-radius: 50%;
}
.back-hinge-spine::before { left: -2px; }
.back-hinge-spine::after  { right: -2px; }

/* Pull-out antenna — base sticking out of the body, then a thin pulled-out rod */
.antenna-stub {
  position: absolute;
  top: -10px;
  right: 38px;
  width: 11px;
  height: 14px;
  background: linear-gradient(180deg, #4a4a52 0%, #2a2a34 50%, #1a1a24 100%);
  border-radius: 4px 4px 1px 1px;
  box-shadow:
    inset 1px 0 0 rgba(255,255,255,0.12),
    inset -1px 0 0 rgba(0,0,0,0.5),
    0 -1px 3px rgba(0,0,0,0.5);
}
/* Thin antenna rod extended upward */
.antenna-stub::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 2.5px;
  height: 42px;
  background: linear-gradient(180deg, #888 0%, #444 60%, #222 100%);
  border-radius: 1.5px 1.5px 0 0;
  box-shadow:
    inset 0.5px 0 0 rgba(255,255,255,0.25),
    inset -0.5px 0 0 rgba(0,0,0,0.4);
}
/* Antenna tip — elongated teardrop/oval finial (real ガラケー style) */
.antenna-stub::after {
  content: "";
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 14px;
  background: linear-gradient(180deg, #aaa 0%, #888 30%, #555 70%, #2a2a2a 100%);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.4),
    inset -1px -1px 1px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.6);
}

/* Side buttons (volume) on the left edge of the closed phone */
.side-btn {
  position: absolute;
  left: -3px;
  width: 4px;
  background: linear-gradient(90deg, #0a0a14 0%, #2a2a34 60%, #1a1a22 100%);
  border-radius: 2px 0 0 2px;
  box-shadow:
    -1px 0 3px rgba(0,0,0,0.6),
    inset 1px 0 0 rgba(255,255,255,0.06);
}
.side-btn.vol-up   { top: 96px;  height: 28px; }
.side-btn.vol-down { top: 132px; height: 28px; }

/* Tiny notification LED */
.notif-led {
  position: absolute;
  top: 12px;
  right: 18px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff2244;
  box-shadow:
    0 0 4px rgba(255,40,80,0.95),
    0 0 10px rgba(255,40,80,0.6),
    0 0 18px rgba(255,40,80,0.35);
  animation: led-blink 1.4s ease-in-out infinite;
}
@keyframes led-blink {
  0%, 60%, 100% { opacity: 0.15; box-shadow: 0 0 2px rgba(255,40,80,0.5); }
  70%, 90%      { opacity: 1;    box-shadow: 0 0 4px rgba(255,40,80,0.95), 0 0 12px rgba(255,40,80,0.7), 0 0 20px rgba(255,40,80,0.4); }
}

/* FOMA carrier text near top */
.back-carrier {
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.1em;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .phone, .phone-top-wrap, .sub-display, .sub-display::before,
  .marquee, .header-stars, .prof-img-frame, .imode-cell.active {
    animation: none !important;
    transition: none !important;
  }
  .press-hint { display: none; }
}

/* Legacy phone is preserved in HTML but hidden — override class display rules */
.phone[hidden],
.press-hint[hidden] { display: none !important; }

/* ═══════════════════════════════════════
   IMAGE-BASED PHONE
   Image: 640 × 1200 px
   Screen rect: left 23.75% / top 27.50% / width 52.34% / height 22.08%
   ═══════════════════════════════════════ */
.phone-img {
  position: relative;
  height: calc(100dvh - 48px);
  max-height: 1000px;
  aspect-ratio: 640 / 1200;
  flex-shrink: 0;
}

/* Image is layered ON TOP of the screen content so the bezel cleanly
   covers the screen rectangle's edges (transparent cutout in the PNG). */
.phone-img-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* Soft white halo around the phone — Cyber-shot poster vibes.
     Stacked drop-shadows create a layered glow that follows the phone outline. */
  filter:
    drop-shadow(0 0 18px rgba(255,255,255,0.65))
    drop-shadow(0 0 48px rgba(255,255,255,0.35))
    drop-shadow(0 0 96px rgba(255,255,255,0.18));
}

.phone-img-screen {
  position: absolute;
  left: 23.75%;
  top: 27.50%;
  width: 52.34%;
  height: 22.08%;
  overflow: hidden;
  z-index: 1;
}

/* Make screen-stage fill the new screen overlay (override legacy fixed height) */
.phone-img-screen .screen-stage {
  height: 100%;
  width: 100%;
  position: relative;
}

/* On phones, prioritize screen size — let the phone overflow horizontally
   (rounded edges get clipped slightly) and vertically (bottom may cut). */
@media (max-width: 600px) {
  body { padding: 8px 0 0; }
  .phone-img {
    height: auto;
    max-height: none;
    width: 115vw;
  }
  /* Halo scaled down — large blurs eat into the visible gradient on small viewports. */
  .phone-img-bg {
    filter:
      drop-shadow(0 0 10px rgba(255,255,255,0.55))
      drop-shadow(0 0 28px rgba(255,255,255,0.25));
  }
}

/* ═══════════════════════════════════════
   GARA-KEI LCD AESTHETIC OVERRIDES
   Old monochrome LCDs only had dark "dots" on a green background.
   No white text, no translucent panels, no emoji.
   ═══════════════════════════════════════ */

/* Hardcoded white text inside the screen → dark olive */
.screen-inner .marquee,
.screen-inner .header h1,
.screen-inner .header .subtitle,
.screen-inner .counter-bar,
.screen-inner .screen-footer,
.screen-inner .neo-badge {
  color: var(--answer-text);
  text-shadow: none;
}

/* Translucent white panels → subtle darker fills with dark dashed borders */
.screen-inner .marquee-wrap {
  background: transparent;
  border-bottom: 1px dashed var(--answer-text-2);
  border-radius: 0;
  padding: 0 0 4px;
  margin-bottom: 10px;
}

.screen-inner .hitokoto-box,
.screen-inner .link-item,
.screen-inner .guestbook-box {
  background: rgba(0,0,0,0.06);
  border-color: var(--answer-text-2);
}

.screen-inner .link-item:hover {
  background: rgba(0,0,0,0.12);
}

.screen-inner .screen-footer {
  border-top-color: var(--answer-text-2);
}

.screen-inner .neo-badge {
  background: rgba(0,0,0,0.1);
}

/* Counter inset = LCD-within-LCD: dark olive box with light green digits (reverse video) */
.screen-inner .counter {
  background: var(--label-bg);
  color: var(--label-text);
  border-color: var(--answer-text-2);
}

/* Guestbook button uses the same reverse-video highlight as labels */
.screen-inner .gb-btn {
  color: var(--label-text);
}
