@font-face {
  font-family: 'Pretendard';
  src: url('../assets/fonts/PretendardVariable.woff2') format('woff2-variations'),
       url('../assets/fonts/PretendardVariable.woff2') format('woff2');
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --bg: #05070f;
  --panel: rgba(14, 18, 34, 0.86);
  --panel-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 228, 196, 0.12);
  --text: #f3ece2;
  --muted: #b3acc4;
  --faint: #8a84a0;
  --accent: #ffb86b;
  --accent-2: #ff8f5a;
  --good: #8ee6b0;
  --paper: #f6efe1;
  --ink: #3b302c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- stage */

#stage { position: fixed; inset: 0; overflow: hidden; }
#screen { position: absolute; display: block; image-rendering: auto; }

.nametag {
  position: absolute;
  transform: translate(-50%, 0);
  padding: 1px 7px 2px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fffaf0;
  text-shadow: 0 0 2px #000, 0 1px 2px #000, 1px 0 1px #000, -1px 0 1px #000;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

.pettag { font-weight: 550; opacity: 0.9; padding: 0 5px 1px; }

.hovertip {
  position: fixed;
  z-index: 30;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(10, 12, 24, 0.86);
  border: 1px solid var(--line);
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(14px, 14px);
}
.hovertip b { color: var(--accent); font-weight: 650; margin-right: 6px; }

#markers { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.marker {
  position: absolute;
  width: 26px; height: 12px;
  margin: -6px 0 0 -13px;
  border: 2px solid rgba(255, 220, 170, 0.85);
  border-radius: 50%;
  animation: marker 0.7s ease-out forwards;
}
@keyframes marker { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* ---------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, border-color 0.18s;
}
.btn:hover { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 228, 196, 0.25); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #ffc27e, #ff9a5c);
  color: #2b1a10;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(255, 140, 70, 0.32);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffcd92, #ffa66c); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: default; }
.mini {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  min-width: 30px; height: 30px;
  padding: 0 6px;
  cursor: pointer;
  font-size: 14px;
}
.mini:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------------------------------------------------------------- screens */

.screen { position: fixed; inset: 0; z-index: 10; }

#title {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 7vh 16px 6vh;
  background: linear-gradient(180deg, rgba(4, 6, 16, 0.55) 0%, rgba(4, 6, 16, 0) 32%, rgba(4, 6, 16, 0) 62%, rgba(4, 6, 16, 0.6) 100%);
  animation: fadein 1.6s ease both;
}
.title-top { text-align: center; }
.title-en {
  font-size: 13px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 228, 196, 0.7);
  margin-bottom: 10px;
}
#title h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 76px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff6ea;
  text-shadow: 0 0 28px rgba(255, 170, 100, 0.45), 0 4px 18px rgba(0, 0, 0, 0.6);
}
.tagline { margin: 12px 0 0; color: rgba(243, 236, 226, 0.85); font-size: clamp(14px, 1.6vw, 17px); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.title-bottom { text-align: center; }
.menu { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.menu .btn { min-width: 150px; backdrop-filter: blur(6px); }
.hint { margin: 14px 0 0; font-size: 13px; color: rgba(243, 236, 226, 0.65); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* creator */
#creator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 16, 0.45);
  animation: fadein 0.4s ease both;
}
.creator {
  width: min(1020px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.creator header { padding: 20px 24px 8px; }
.creator h2 { margin: 0; font-size: 22px; font-weight: 750; }
.creator header p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.creator-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.25fr);
  gap: 18px;
  padding: 14px 24px;
  overflow: auto;
}
.creator footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}
.cands { display: flex; flex-direction: column; gap: 12px; }
.cand-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cand {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 85%, rgba(255, 170, 100, 0.18), rgba(255, 255, 255, 0.03) 70%);
  padding: 8px 4px 6px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, transform 0.12s, background 0.2s;
}
.cand:hover { transform: translateY(-2px); border-color: rgba(255, 228, 196, 0.3); }
.cand.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cand canvas { display: block; margin: 0 auto; image-rendering: pixelated; width: 64px; height: 88px; }
.cand span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.editor { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#preview {
  width: 200px; height: 270px;
  image-rendering: pixelated;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0c1124;
}
.preview-dirs { display: flex; gap: 8px; }
.edit-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.name-row { display: flex; align-items: center; gap: 8px; }
.name-row span { font-size: 13px; color: var(--muted); width: 66px; flex: none; }
.name-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  user-select: text;
}
.name-row input:focus { outline: none; border-color: var(--accent); }
.parts { display: flex; flex-direction: column; gap: 5px; }
.part { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.part .lbl { width: 66px; flex: none; color: var(--muted); }
.part .val { flex: 1; min-width: 0; text-align: center; padding: 5px 4px; border-radius: 8px; background: var(--panel-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; gap: 6px; }
.part .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; border: 1px solid rgba(255, 255, 255, 0.25); }
.part .mini { min-width: 28px; height: 28px; }
.part.dim { opacity: 0.38; }

/* the animal friend chooser */
.petpick { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.pp-head { display: flex; align-items: baseline; gap: 8px; }
.pp-head b { font-size: 15px; font-weight: 700; }
.pp-head small { color: var(--muted); font-size: 12px; }
.pp-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-tabs button { flex: 1; }
.pet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px;
  /* as tall as the screen allows next to everything else (so the creator need not scroll), 2–3 rows */
  max-height: clamp(150px, calc(100vh - 635px), 300px); overflow-y: auto; padding: 2px 4px 2px 2px;
}
.pet {
  appearance: none; border: 1px solid var(--line); border-radius: 10px; padding: 5px 2px 4px; cursor: pointer;
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 170, 100, 0.14), rgba(255, 255, 255, 0.03) 70%);
  color: var(--text); text-align: center; transition: border-color 0.15s, transform 0.12s;
}
.pet:hover { transform: translateY(-1px); border-color: rgba(255, 228, 196, 0.3); }
.pet.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pet canvas { display: block; margin: 0 auto; width: 64px; height: 60px; image-rendering: pixelated; }
.pet span { display: block; font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the chosen one, big, under the friend's preview */
.pet-stage { width: 200px; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
#pet-preview { width: 200px; height: 150px; image-rendering: pixelated; border-radius: 14px; border: 1px solid var(--line); background: #0c1124; cursor: pointer; }
#pet-preview.empty { cursor: default; }
.pet-text { font-size: 13px; line-height: 1.45; min-width: 0; }
.pet-text b { color: var(--accent); font-size: 15px; margin-right: 6px; }
.pet-text .br { color: var(--muted); font-size: 12px; }
.pet-text p { margin: 3px 0 4px; color: var(--text); }
.pet-text p.none { color: var(--muted); }
.pet-text .tags i { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-right: 4px; white-space: nowrap; }

/* side panels */
.side {
  position: fixed;
  top: 64px;
  right: 14px;
  width: min(370px, calc(100vw - 28px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  z-index: 20;
  padding: 18px 18px 16px;
  animation: slidein 0.22s ease both;
}
@keyframes slidein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.side h3 { margin: 0 0 12px; font-size: 17px; font-weight: 750; display: flex; align-items: center; justify-content: space-between; }
.side h4 { margin: 18px 0 8px; font-size: 13px; color: var(--accent); font-weight: 650; letter-spacing: 0.02em; }
.side .x { appearance: none; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 6px; }
.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.row > span:first-child { width: 92px; flex: none; color: var(--muted); }
.row input[type=range] { flex: 1; accent-color: var(--accent); }
.row .num { width: 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--faint); font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.seg button.on { background: rgba(255, 184, 107, 0.2); border-color: var(--accent); color: #ffe2c2; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; font-size: 14px; cursor: pointer; }
.switch input { display: none; }
.switch i { width: 38px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, 0.14); position: relative; transition: background 0.2s; flex: none; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + i { background: var(--accent-2); }
.switch input:checked + i::after { transform: translateX(16px); }
.note { font-size: 12px; color: var(--faint); line-height: 1.55; margin: 6px 0 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.keys kbd { font: inherit; font-size: 12px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }

/* music panel */
.np { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; background: var(--panel-2); }
.np .t { font-size: 17px; font-weight: 700; }
.np .s { font-size: 12px; color: var(--muted); }
.np .bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 8px; }
.np .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.np .ctl { display: flex; gap: 8px; margin-top: 10px; }
.tracks { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tracks li { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.tracks li:hover { background: var(--panel-2); }
.tracks li.on { background: rgba(255, 184, 107, 0.14); }
.tracks li b { font-weight: 600; font-size: 14px; }
.tracks li small { color: var(--faint); font-size: 12px; margin-left: auto; white-space: nowrap; }
.tracks li .tseason { font-style: normal; font-size: 12px; margin-left: 3px; opacity: 0.85; }

/* inbox */
.mails { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mails li { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); cursor: pointer; border: 1px solid transparent; }
.mails li:hover { border-color: var(--line); }
.mails li p { margin: 0; font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mails li small { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; }
.empty { color: var(--faint); font-size: 13px; text-align: center; padding: 24px 0; }

/* ---------------------------------------------------------------- HUD */

#hud { position: fixed; inset: 0; z-index: 8; pointer-events: none; animation: fadein 0.8s ease both; }
#hud > * { pointer-events: auto; }
.hud-title {
  position: absolute; left: 18px; top: 16px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
  color: rgba(255, 240, 222, 0.6);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none !important;
}
.topbar { position: absolute; right: 14px; top: 12px; display: flex; gap: 6px; }
.topbar button {
  position: relative;
  appearance: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(12, 15, 30, 0.6);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: grid; place-items: center;
  color: rgba(255, 240, 222, 0.88);
  transition: background 0.15s;
}
.topbar button:hover, .topbar button.on { background: rgba(40, 46, 80, 0.85); }
.topbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.notice {
  position: absolute; left: 50%; top: 14px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px 9px 16px;
  border-radius: 14px;
  background: rgba(14, 22, 30, 0.82);
  border: 1px solid rgba(142, 230, 176, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 24px rgba(120, 230, 170, 0.12);
  font-size: 14px;
  animation: drop 0.4s ease both;
  max-width: calc(100vw - 260px);
}
.notice .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); animation: blink 1.2s infinite; flex: none; }
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.nowplaying {
  position: absolute; left: 14px; top: 92px;
  max-width: min(360px, 42vw);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(12, 15, 30, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: opacity 0.6s, padding 0.4s;
}
.nowplaying .t { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowplaying .t::before { content: '♪ '; color: var(--accent); }
.nowplaying .s { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowplaying.quiet { opacity: 0.55; padding: 6px 12px; }
.nowplaying.quiet .s { display: none; }
.nowplaying.off { opacity: 0.35; }

.bottom {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  width: max-content;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none !important;
}
.status {
  font-size: 14px;
  color: rgba(255, 244, 230, 0.9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  min-height: 20px;
}
.status b { color: var(--accent); font-weight: 700; }
.status .pst { display: block; text-align: center; font-size: 12.5px; opacity: 0.88; margin-top: 2px; }
.status .pst b { color: #ffd9a8; }
.actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 5px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(12, 15, 30, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.actions button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  color: rgba(255, 244, 230, 0.9);
  white-space: nowrap;
}
.actions button:hover { background: rgba(255, 255, 255, 0.09); }
.actions button.on { background: rgba(255, 184, 107, 0.18); border-color: rgba(255, 184, 107, 0.45); }
.actions .sep { width: 1px; background: var(--line); margin: 4px 2px; }
.actions .auto.on { background: rgba(142, 230, 176, 0.15); border-color: rgba(142, 230, 176, 0.4); }

/* the friend's face, bottom left (js/face.js): the sprite up close, four screen pixels to one */
.face {
  position: absolute; left: 14px; bottom: 14px;
  display: flex; gap: 6px;
  padding: 7px 7px 6px;
  border-radius: 14px;
  background: rgba(12, 15, 30, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  transition: border-color 0.4s;
}
.face.off { display: none; }
.face-cell {
  appearance: none; border: 0; padding: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  color: var(--text); font: inherit; cursor: pointer;
}
.face-cell:hover canvas { box-shadow: inset 0 0 0 1px rgba(255, 228, 196, 0.35); }
.face-cell.inside canvas { filter: brightness(0.55) saturate(0.6); }
.face canvas {
  display: block; width: 104px; height: 112px; margin-bottom: 4px;
  image-rendering: pixelated;
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 105%, rgba(255, 158, 88, 0.5), rgba(86, 46, 34, 0.42) 52%, rgba(18, 16, 32, 0.7));
  box-shadow: inset 0 0 0 1px rgba(255, 228, 196, 0.1);
}
.face-name { font-size: 12px; font-weight: 700; max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-mood { font-size: 11px; color: var(--muted); max-width: 108px; text-align: center; line-height: 1.3; }
/* two faces (with an animal friend): three screen pixels to one, so both still fit the corner */
.face.two canvas { width: 78px; height: 84px; }
.face.two .face-name, .face.two .face-mood { max-width: 84px; }
.face.two .face-name { font-size: 11.5px; }
.face.two .face-mood { font-size: 10.5px; }
.face.t3 #face-me .face-mood, .face.t4 #face-me .face-mood { color: #ffb38a; }
.face.t4 { border-color: rgba(255, 160, 120, 0.35); }

/* only one tab runs the game (js/tabguard.js): the notice in the others */
.tabguard {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 60%, rgba(60, 30, 14, 0.55), rgba(5, 7, 15, 0.92));
  backdrop-filter: blur(3px);
}
.tg-card {
  width: min(440px, 100%); padding: 28px 26px 22px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text);
}
.tg-ic { font-size: 34px; filter: drop-shadow(0 0 12px rgba(255, 150, 60, 0.6)); }
.tg-card h2 { margin: 10px 0 8px; font-size: 20px; }
.tg-card p { margin: 0 0 18px; color: var(--muted); line-height: 1.65; font-size: 14px; }
.tg-card small { display: block; margin-top: 10px; color: var(--faint); font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 120px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(10, 12, 24, 0.88);
  border: 1px solid var(--line);
  font-size: 14px;
  animation: fadein 0.25s ease both;
  pointer-events: none;
}

/* ---------------------------------------------------------------- letter */

.rx-wrap {
  position: fixed; inset: 0; z-index: 25;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(4, 6, 16, 0.2), rgba(4, 6, 16, 0.6));
  animation: fadein 0.3s ease both;
}
.rx-wrap.closing { animation: fadeout 0.8s ease both; }
@keyframes fadeout { to { opacity: 0; } }

/* the receiver's casing: dark painted metal with a little wear */
.rx {
  --phos: #9dffb8;
  --phos-dim: #4fb878;
  position: relative;
  width: min(660px, 100%);
  padding: 16px 18px 14px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 2px, rgba(0,0,0,0.02) 2px 4px),
    linear-gradient(180deg, #3b3f3a 0%, #2b2e2a 55%, #222421 100%);
  border: 1px solid #4a4f48;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.4);
  color: #d9d4c4;
  animation: rxIn 0.45s cubic-bezier(.2,.9,.3,1.08) both;
  font-family: 'Pretendard', system-ui, sans-serif;
}
@keyframes rxIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.screw { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #9a9f96, #4b4f49 70%); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4); }
.screw::after { content: ''; position: absolute; left: 1px; right: 1px; top: 4px; height: 1px; background: rgba(0,0,0,0.55); transform: rotate(35deg); }
.screw.s1 { left: 7px; top: 7px; } .screw.s2 { right: 7px; top: 7px; } .screw.s3 { left: 7px; bottom: 7px; } .screw.s4 { right: 7px; bottom: 7px; }

.rx-top { display: flex; align-items: center; gap: 14px; padding: 2px 8px 12px; }
.rx-brand { display: flex; flex-direction: column; line-height: 1.2; }
.rx-brand b { font: 700 15px 'Consolas', 'Cascadia Code', monospace; letter-spacing: 0.16em; color: #e9e3d0; }
.rx-brand span { font-size: 11px; color: #9a9686; letter-spacing: 0.08em; }
.rx-meter {
  width: 112px; height: 60px; flex: none; margin-left: auto;
  border-radius: 6px;
  background: linear-gradient(180deg, #f1e7c8, #ddd0a8);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.45), 0 0 0 2px #1d1f1c;
  overflow: hidden;
}
.rx-meter svg { width: 100%; height: 100%; display: block; }
.rx-meter .arc { fill: none; stroke: #3a3328; stroke-width: 1.4; }
.rx-meter .arc.red { stroke: #b4382a; stroke-width: 2.4; }
.rx-meter .ticks line { stroke: #3a3328; stroke-width: 1; }
.rx-meter text { font: 700 8px 'Consolas', monospace; fill: #5a5040; text-anchor: middle; letter-spacing: 0.1em; }
.rx-meter #rx-needle line { stroke: #c02a1e; stroke-width: 1.6; stroke-linecap: round; }
.rx-meter #rx-needle { transform-origin: 60px 58px; transform: rotate(-55deg); transition: transform 0.12s linear; }
.rx-meter circle { fill: #2a2622; }
.rx-freq {
  flex: none;
  min-width: 128px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #0d0a06;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8), 0 0 0 2px #1d1f1c;
  font: 700 22px 'Consolas', 'Cascadia Code', monospace;
  letter-spacing: 0.06em;
  color: #ffb44a;
  text-shadow: 0 0 6px rgba(255, 170, 60, 0.75), 0 0 14px rgba(255, 140, 40, 0.35);
  text-align: right;
}
.rx-freq small { font-size: 11px; margin-left: 4px; color: #d0903a; }
.rx-leds { display: flex; flex-direction: column; gap: 6px; font: 700 11px 'Consolas', monospace; color: #a8a392; letter-spacing: 0.1em; }
.rx-leds span { display: flex; align-items: center; gap: 6px; }
.led { width: 9px; height: 9px; border-radius: 50%; background: #2c2f2b; box-shadow: inset 0 1px 2px rgba(0,0,0,0.7); }
.led.g.on { background: #8dff9c; box-shadow: 0 0 8px #6dff8a, 0 0 2px #fff inset; }
.led.r.on { background: #ff6a5a; box-shadow: 0 0 8px #ff4a3a, 0 0 2px #fff inset; }

/* the CRT: green phosphor, scanlines, a soft curved glass */
.rx-bezel {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #151614, #1f211e);
  box-shadow: inset 0 3px 10px rgba(0,0,0,0.75), inset 0 -1px 0 rgba(255,255,255,0.06);
}
/* The glass: clips its effects (overflow hidden) and never scrolls. */
.rx-crt {
  position: relative;
  overflow: hidden;
  border-radius: 22px / 18px;
  background: radial-gradient(ellipse at 50% 45%, #0f2a1b 0%, #08180f 62%, #030a06 100%);
  box-shadow: inset 0 0 48px rgba(0,0,0,0.9), inset 0 0 10px rgba(120, 255, 160, 0.12);
  color: var(--phos);
  text-shadow: 0 0 3px rgba(140, 255, 175, 0.85), 0 0 12px rgba(80, 255, 140, 0.32);
  animation: flicker 4.5s infinite steps(1);
}
/* The text scrolls on its own layer underneath the glass effects. */
.rx-scroll {
  position: relative;
  z-index: 1;
  height: clamp(220px, 44vh, 340px);  /* a fixed screen: the receiver never jumps while typing */
  overflow-y: auto;
  padding: 18px 22px 20px;
  scrollbar-width: none;
}
.rx-scroll::-webkit-scrollbar { display: none; }
.rx-crt::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.32) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.rx-crt::after {
  content: ''; position: absolute; left: 0; right: 0; height: 90px; top: -90px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(150, 255, 190, 0.05), transparent);
  animation: sweep 6s linear infinite;
}
@keyframes sweep { to { transform: translateY(520px); } }
@keyframes flicker { 0% { opacity: 1; } 48% { opacity: 0.97; } 50% { opacity: 1; } 77% { opacity: 0.985; } }
.rx-head {
  display: flex; justify-content: space-between; gap: 10px;
  font: 600 12px 'Consolas', 'Cascadia Code', monospace;
  letter-spacing: 0.06em;
  color: var(--phos-dim);
  border-bottom: 1px dashed rgba(120, 255, 160, 0.25);
  padding-bottom: 8px; margin-bottom: 12px;
  white-space: nowrap;
}
.rx-text {
  min-height: 120px;
  font-size: 19px;
  line-height: 1.75;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: pre-wrap;
  word-break: keep-all;
  user-select: text;
}
.rx-text .cur { display: inline-block; width: 0.55em; height: 1.05em; background: var(--phos); vertical-align: -0.15em; margin-left: 2px; box-shadow: 0 0 8px rgba(140,255,175,0.8); animation: blink 0.8s infinite steps(1); }
.rx-from { margin-top: 14px; text-align: right; font-size: 14px; color: var(--phos-dim); min-height: 22px; }
.rx-from b { color: var(--phos); font-weight: 600; }
.rx-from small { display: block; font-size: 12px; opacity: 0.8; margin-top: 2px; }
.tx-input {
  display: block;
  width: 100%;
  min-height: 110px;
  margin-top: 4px;
  resize: none;
  border: 1px dashed rgba(120, 255, 160, 0.35);
  border-radius: 8px;
  background: rgba(0, 20, 8, 0.35);
  color: var(--phos);
  caret-color: var(--phos);
  text-shadow: inherit;
  font: 500 18px/1.7 'Pretendard', system-ui, sans-serif;
  padding: 8px 10px;
  outline: none;
  user-select: text;
}
.tx-input::placeholder { color: rgba(120, 255, 160, 0.35); }

.rx-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 6px 2px; flex-wrap: wrap; }
.rx-switch { display: flex; border-radius: 8px; padding: 3px; background: #161815; box-shadow: inset 0 2px 5px rgba(0,0,0,0.7); }
.rx-switch button {
  appearance: none; border: 0; background: transparent; color: #8f8b7c;
  font: 600 12px 'Pretendard', system-ui, sans-serif; padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.rx-switch button.on { background: linear-gradient(180deg, #5d6258, #44483f); color: #f1ead6; box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 2px 4px rgba(0,0,0,0.5); }
.rx-mode { font: 700 11px 'Consolas', monospace; letter-spacing: 0.12em; color: #b9b39d; padding: 5px 10px; border-radius: 6px; background: #161815; box-shadow: inset 0 2px 5px rgba(0,0,0,0.7); }
.rx-keys { display: flex; gap: 8px; }
.key {
  appearance: none;
  border: 1px solid #1a1c19;
  border-radius: 7px;
  padding: 8px 16px;
  font: 700 13px 'Pretendard', system-ui, sans-serif;
  color: #2a2620;
  background: linear-gradient(180deg, #ece4cd, #cfc4a6);
  box-shadow: 0 3px 0 #8f8670, 0 4px 8px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.6);
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 #8f8670, 0 2px 4px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.6); }
.key.dark { color: #ebe5d2; background: linear-gradient(180deg, #5a5e55, #3e413a); box-shadow: 0 3px 0 #22241f, 0 4px 8px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15); }
.key.go { color: #1f2a12; background: linear-gradient(180deg, #c8f0a0, #97cf6c); box-shadow: 0 3px 0 #5d8a3c, 0 4px 8px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.6); }
.key:disabled { opacity: 0.45; cursor: default; }

/* the Stevenson screen's instrument panel: same painted metal, cream gauge faces */
.wxp {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 16px 18px 14px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 2px, rgba(0,0,0,0.02) 2px 4px),
    linear-gradient(180deg, #3b3f3a 0%, #2b2e2a 55%, #222421 100%);
  border: 1px solid #4a4f48;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #d9d4c4;
  animation: rxIn 0.45s cubic-bezier(.2,.9,.3,1.08) both;
}
.wx-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 8px 12px; }
.wx-src { display: flex; align-items: center; gap: 7px; font: 600 12px 'Pretendard', system-ui, sans-serif; color: #c9c3b0; }
.wx-gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.gauge {
  border-radius: 10px;
  padding: 10px 8px 9px;
  background: linear-gradient(180deg, #f1e7c8, #ddd0a8);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 0 0 2px #1d1f1c;
  color: #3a3328;
  text-align: center;
}
.gauge svg { width: 100%; height: 96px; display: block; }
.gauge .g-val { font: 700 18px 'Consolas', 'Cascadia Code', monospace; margin-top: 4px; color: #2a2620; }
.gauge .g-lbl { font-size: 12px; color: #6a5e4a; }
.thermo .glass { fill: #fbf7ea; stroke: #6a5e4a; stroke-width: 1.2; }
.thermo .merc, .thermo .bulb { fill: #c4302a; }
.thermo .bulb { stroke: #6a5e4a; stroke-width: 1.2; }
.thermo #wx-merc { transition: y 0.8s ease, height 0.8s ease; }
.thermo line { stroke: #5a5040; stroke-width: 1; }
.thermo text { font: 700 8px 'Consolas', monospace; fill: #5a5040; }
.dial .arc { fill: none; stroke: #3a3328; stroke-width: 1.4; }
.dial line { stroke: #3a3328; stroke-width: 1; }
.dial text { font: 700 9px 'Consolas', monospace; fill: #5a5040; text-anchor: middle; }
.dial #wx-hneedle { transform-origin: 60px 66px; transition: transform 0.8s ease; }
.dial #wx-hneedle line { stroke: #c02a1e; stroke-width: 1.8; stroke-linecap: round; }
.dial circle { fill: #2a2622; }
.compass .ring, .cover .ring { fill: #fbf7ea; stroke: #5a5040; stroke-width: 1.5; }
.compass text { font: 700 10px 'Consolas', monospace; fill: #5a5040; text-anchor: middle; }
.compass #wx-vane { transform-origin: 50px 50px; transition: transform 0.8s ease; }
.compass .vane { fill: #c02a1e; } .compass .tail { fill: #3a3328; } .compass .hub { fill: #2a2622; }
.cover .pie { fill: #3a3328; }
.wx-rows { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: #161815; box-shadow: inset 0 2px 6px rgba(0,0,0,0.7); }
.wx-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.07); font-size: 14px; }
.wx-row:last-child { border-bottom: 0; }
.wx-row > span:first-child { width: 40px; flex: none; color: #8f8b7c; font-size: 12px; }
.wx-row b { color: #ffcf7a; font-weight: 650; text-shadow: 0 0 6px rgba(255, 170, 60, 0.35); }
.wx-row small { color: #9a9686; margin-left: auto; text-align: right; font-size: 12px; }
.sunarc { width: 160px; height: 56px; flex: none; }
.sunarc .band { fill: #1d2748; transition: fill 1s; }
.sunarc[data-kind="day"] .band { fill: #8fb8e6; }
.sunarc[data-kind="dawn"] .band { fill: #d9a3a0; }
.sunarc[data-kind="dusk"] .band { fill: #d8876a; }
.sunarc .ground { fill: #2a2f24; }
.sunarc .path { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 1.2; stroke-dasharray: 3 3; }
.sunarc .path.night { stroke: rgba(255, 255, 255, 0.16); }
.sunarc .hz { stroke: #8a8676; stroke-width: 1; }
.sunarc .sun { fill: #ffc04a; filter: drop-shadow(0 0 3px #ffb030); transition: cx 1s, cy 1s; }
.sunarc .sun.below { fill: #7a5f36; filter: none; }
.sunarc .moon { opacity: 0; transition: opacity 1s; }
.sunarc[data-kind="night"] .moon, .sunarc[data-kind="dusk"] .moon, .sunarc[data-kind="dawn"] .moon { opacity: 1; }
.moon-dark { fill: #343b55; }
.moon-lit { fill: #f1ecd8; }
.moonicon { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 0 4px rgba(220, 230, 255, 0.25)); }
.wx-note { color: #a8a392; font-size: 12px; flex: 1; min-width: 160px; }

/* the weather chip in the HUD */
.wxchip {
  position: absolute; left: 14px; top: 40px;
  max-width: min(380px, 44vw);
  appearance: none; text-align: left;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(12, 15, 30, 0.6);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  cursor: pointer;
  color: var(--text);
}
.wxchip .t { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wxchip .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.wxchip:hover { background: rgba(30, 36, 64, 0.8); }
.locbox { display: flex; gap: 6px; margin: 8px 0; }
.locbox input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,0.25); color: var(--text); font: inherit; font-size: 13px; user-select: text; }
.locres { list-style: none; margin: 4px 0 0; padding: 0; }
.locres li { padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.locres li:hover { background: var(--panel-2); }
.locres li small { color: var(--faint); margin-left: 6px; }

/* ---------------------------------------------------------------- HUD left stack */

.hud-left {
  position: absolute; left: 14px; top: 40px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  pointer-events: none !important;
}
.hud-left > * { pointer-events: auto; }
.hud-left .wxchip, .hud-left .nowplaying { position: static; }
.chronochip .t.ring { color: #ffcf7a; }
.chronochip.ringing { border-color: #ffb44a; animation: ringPulse 1.2s ease-in-out infinite; }
.chronochip .breathe { animation: blink 2.6s ease-in-out infinite; }
.chronochip .dim { opacity: 0.6; }

/* ---------------------------------------------------------------- alarm / pomodoro cards */

.topcards {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 45;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.topcards > * { pointer-events: auto; }
.topcards .notice { position: static; transform: none; animation: none; max-width: none; }
.ccard {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  background: rgba(28, 30, 27, 0.95);
  border: 1px solid #4a4f48;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: #e9e3d0;
  animation: cardIn 0.35s ease both;
  transition: opacity 0.4s, transform 0.4s;
}
.ccard.out { opacity: 0; transform: translateY(-6px); }
.ccard .ic { font-size: 20px; }
.ccard .tx { display: flex; flex-direction: column; line-height: 1.35; }
.ccard .tx b { font-size: 14px; }
.ccard .tx span { font-size: 13px; color: #c9c3b0; }
.ccard .tx small { font-size: 12px; color: #8f8b7c; }
.ccard.ring { border-color: #ffb44a; animation: cardIn 0.35s ease both, ringPulse 1.2s ease-in-out infinite; }
.ccard.focus { border-color: #ff9a7e; }
.ccard.rest { border-color: #7fe0c0; }
.ccard.wait { animation: cardIn 0.35s ease both, breathe 5s ease-in-out infinite; }
.ccard.quiet { border-color: #6a6f78; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes ringPulse { 50% { box-shadow: 0 0 22px rgba(255, 180, 74, 0.55), 0 10px 30px rgba(0, 0, 0, 0.45); } }
@keyframes breathe { 50% { box-shadow: 0 0 18px rgba(127, 224, 192, 0.4), 0 10px 30px rgba(0, 0, 0, 0.45); } }

/* ---------------------------------------------------------------- the chronometer */

.chrono { width: min(880px, 100%); }
.ch-now { font-size: 20px; min-width: 124px; text-align: center; }
.ch-body { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(300px, 1.25fr); gap: 12px; }
.ch-left, .ch-right { background: #161815; border-radius: 10px; padding: 12px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7); min-width: 0; }
.ch-modes { margin-bottom: 10px; width: 100%; }
.ch-modes button { flex: 1; }
.ch-field { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.ch-field span { width: 36px; flex: none; color: #8f8b7c; font-size: 12px; }
.ch-field input {
  flex: 1; min-width: 0;
  background: #0d0f0c; border: 1px solid #3a3f38; border-radius: 7px;
  color: #f1ead6; padding: 7px 9px; font: inherit; font-size: 13px; user-select: text; outline: none;
}
.ch-field input:focus { border-color: #ffb44a; }
.ch-sub { font-size: 12px; color: #8f8b7c; margin: 10px 0 6px; }
.ch-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ch-presets .key { padding: 7px 0; }
.ch-custom, .ch-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.ch-row span { width: 44px; flex: none; font-size: 12px; color: #8f8b7c; }
.ch-custom input, .ch-row input { flex: 1; min-width: 0; accent-color: #ffb44a; }
.ch-custom b, .ch-row b { width: 46px; text-align: right; font: 700 13px 'Consolas', monospace; color: #ffcf7a; }
.ch-custom .key { padding: 6px 12px; }
.ch-alarm { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 2px; }
.ch-alarm b { font: 700 30px 'Consolas', monospace; color: #ffb44a; text-shadow: 0 0 8px rgba(255, 170, 60, 0.6); }
.ch-alarm span { color: #a8a392; font-size: 13px; }
.ch-form > .key { margin-top: 8px; }
.ch-today { margin: 10px 0; font-size: 13px; color: #c9c3b0; }
.ch-today b { color: #ff9a7e; }
.chrono .switch { font-size: 13px; color: #d9d4c4; }
.chrono .note { color: #8f8b7c; margin: 2px 0 6px; }
.ch-listhead { display: flex; justify-content: space-between; font-size: 12px; color: #8f8b7c; margin: 8px 2px 6px; }
.ch-listhead b { font: 700 12px 'Consolas', monospace; color: #c9c3b0; }
.ch-list { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow: auto; }
.ch-item { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 10px 10px; border-radius: 8px; background: #20231f; }
.ch-item.paused { opacity: 0.7; }
.ch-it-main { min-width: 0; }
.ch-it-main b { display: block; font-size: 13px; color: #f1ead6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-it-main small { font-size: 11px; color: #8f8b7c; }
.ch-rem { font: 700 16px 'Consolas', monospace; color: #ffcf7a; }
.ch-item .key { padding: 5px 9px; font-size: 12px; }
.ch-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; grid-column: 1 / -1; }
.ch-bar i { display: block; height: 100%; width: 0; background: #ffc860; transition: width 0.5s linear; }
.ch-empty { color: #8f8b7c; font-size: 13px; text-align: center; padding: 18px 0; margin: 0; }
.ch-pcard { border-radius: 10px; padding: 12px; border: 2px solid #ff9a7e; background: linear-gradient(180deg, rgba(255, 154, 126, 0.12), rgba(0, 0, 0, 0)); margin-bottom: 4px; }
.ch-pcard.rest { border-color: #7fe0c0; background: linear-gradient(180deg, rgba(127, 224, 192, 0.12), rgba(0, 0, 0, 0)); }
.ch-pcard.waiting { animation: breathe 5s ease-in-out infinite; }
.ch-pcard.paused .ch-big { opacity: 0.6; }
.ch-pc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #a8a392; }
.ch-pc-main { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 6px; }
.ch-phase { font-size: 18px; color: #f1ead6; }
.ch-big { font: 700 40px 'Consolas', monospace; color: #fff3e4; letter-spacing: 0.02em; }
.ch-pcard .ch-bar i { background: #ff9a7e; }
.ch-pcard.rest .ch-bar i { background: #7fe0c0; }
.ch-pc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ch-pc-foot > span:first-child { font-size: 12px; color: #c9c3b0; }
.ch-btns { display: flex; gap: 6px; }
.ch-btns .key { padding: 5px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- the journal (a leather notebook) */

.jr {
  position: relative;
  width: min(940px, 100%);
  height: min(620px, calc(100vh - 32px));
  display: grid; grid-template-columns: 300px 1fr;
  padding: 12px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0 3px, rgba(0, 0, 0, 0.03) 3px 6px),
    linear-gradient(180deg, #6a4430, #4e3022);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(255, 220, 180, 0.08);
  animation: rxIn 0.4s cubic-bezier(.2,.9,.3,1.08) both;
  color: #3b302c;
}
.jr-left {
  display: flex; flex-direction: column; min-height: 0;
  padding: 16px 14px;
  border-radius: 8px 0 0 8px;
  background: #efe6d2;
  box-shadow: inset -12px 0 14px -10px rgba(0, 0, 0, 0.35);
}
.jr-right {
  min-height: 0; overflow: auto;
  padding: 22px 28px;
  border-radius: 0 8px 8px 0;
  background: radial-gradient(ellipse at 45% 35%, #fbf6e9 0%, #f7efdd 65%, #f0e5cd 100%); /* plain paper, no lines */
  box-shadow: inset 12px 0 14px -10px rgba(0, 0, 0, 0.3);
}
.jr-head { display: flex; justify-content: space-between; align-items: center; }
.jr-head b { font-size: 20px; font-weight: 800; }
.jr-counts { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #7a6a5a; margin: 10px 0 8px; }
.jr-counts b { font-family: 'Consolas', monospace; }
.jr-counts .near b { color: #c07a2a; }
.jr-counts .full b { color: #c0482a; }
.jr-counts .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot.mine { background: #5a9ad0; }
.dot.sig { background: #d89a3a; }
.jr-filter button { background: rgba(0, 0, 0, 0.05); border-color: rgba(90, 60, 30, 0.18); color: #5a4a3a; }
.jr-filter button.on { background: rgba(200, 120, 60, 0.18); border-color: #c8642c; color: #7a3a1a; }
.jr-list { list-style: none; margin: 10px 0 0; padding: 0; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.jr-list.resting { opacity: 0.45; pointer-events: none; }
.jr-list li { position: relative; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.jr-list li:hover { background: rgba(0, 0, 0, 0.05); }
.jr-list li.on { background: rgba(200, 120, 60, 0.12); border-color: rgba(200, 120, 60, 0.35); }
.jr-list li b { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-list li small { font-size: 12px; color: #8a7a6a; }
.jr-list li small em { font-style: normal; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: rgba(216, 154, 58, 0.2); color: #8a5a1a; font-size: 11px; }
.jr-list li.sig { border-left: 3px solid #d89a3a; padding-left: 28px; }
.jr-list li.sig .sigicon { position: absolute; left: 8px; top: 10px; }
.jr-list li.empty { color: #8a7a6a; cursor: default; text-align: center; padding: 24px 0; }
.jr-cap { font-size: 12px; color: #9a7a5a; margin: 8px 0 0; }
.jr-io { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(90, 60, 30, 0.2); }
.jr-io .btn { flex: 1; }
.sigicon { width: 14px; height: 14px; fill: none; stroke: #c07a2a; stroke-width: 1.8; stroke-linecap: round; flex: none; }
.sigicon circle { fill: #c07a2a; stroke: none; }
.jr-x { position: absolute; right: 22px; top: 18px; appearance: none; border: 0; background: none; cursor: pointer; color: #7a6a5a; font-size: 24px; line-height: 1; }
.jr-blank { color: #9a8a7a; text-align: center; margin-top: 28%; line-height: 1.8; }
.jr-kicker { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #a0703a; letter-spacing: 0.04em; }
.jr-date { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.jr-meta { font-size: 13px; color: #7a6a5a; }
.jr-meta i { font-style: normal; color: #a08a6a; }
.jr-sent { display: inline-block; margin-top: 8px; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(216, 154, 58, 0.18); color: #8a5a1a; }
.jr-body { margin-top: 14px; font-size: 16px; line-height: 28px; white-space: pre-wrap; word-break: keep-all; user-select: text; }
.jr-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.jr .btn { color: #3b302c; border-color: rgba(90, 60, 30, 0.25); background: rgba(255, 255, 255, 0.5); }
.jr .btn:hover { background: rgba(255, 255, 255, 0.85); }
.jr .btn.primary { background: linear-gradient(180deg, #ffc27e, #ff9a5c); color: #2b1a10; border-color: transparent; }
.jr .btn.warn { background: #f3c1b0; border-color: #c0482a; color: #7a2a1a; }
.jr .btn small { opacity: 0.6; font-size: 11px; margin-left: 4px; }
.jr-edit { display: flex; flex-direction: column; height: 100%; }
.jr-edit textarea {
  flex: 1; min-height: 240px; margin-top: 10px; resize: none;
  border: 0; outline: none; background: transparent;
  font: 500 16px/28px 'Pretendard', system-ui, sans-serif; color: #3b302c; user-select: text;
}
.jr-edfoot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #8a7a6a; border-top: 1px dashed rgba(90, 60, 30, 0.25); padding-top: 8px; }
#jr-n.warn { color: #c0482a; }
.jr-warn { font-size: 13px; color: #b0502a; margin: 8px 0 0; }
@media (max-width: 760px) {
  .jr { grid-template-columns: 1fr; height: calc(100vh - 32px); }
  .jr-left { border-radius: 8px 8px 0 0; max-height: 40vh; }
  .jr-right { border-radius: 0 0 8px 8px; }
  .ch-body { grid-template-columns: 1fr; }
  .hud-left { top: 58px; left: 12px; }
}

.rx-timer { position: absolute; left: 22px; right: 22px; bottom: 4px; height: 2px; border-radius: 1px; overflow: hidden; }
.rx-timer i { display: block; height: 100%; width: 0; background: rgba(157, 255, 184, 0.45); box-shadow: 0 0 6px rgba(157,255,184,0.6); }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .creator-body { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; justify-items: center; }
  .edit-col { width: 100%; }
  .actions button span.l { display: none; }
  .hud-title { display: none; }
  .notice { max-width: calc(100vw - 32px); top: 62px; }
  .nowplaying { top: 108px; left: 12px; max-width: 46vw; }
  .wxchip { top: 58px; left: 12px; max-width: 60vw; }
  .wx-gauges { grid-template-columns: repeat(2, 1fr); }
  .rx-top { flex-wrap: wrap; }
  .rx-meter { margin-left: 0; }
}
@media (max-height: 520px) {
  #title { padding-top: 3vh; }
  .side { top: 58px; max-height: calc(100vh - 70px); }
}
