/* Copyright (c) 2026 tavro */

:root {
  --ink: #e9dcc2;
  --shade: rgba(4, 3, 8, 0.7);
  --paper: #e4d4b0;
  --paper-ink: #3d3022;
  --mail-ink: #9a6a3c;
  --wood: #6d5639;
  --accent: #e8c27a;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  color: var(--ink);
  font-family: "Void", ui-monospace, monospace;
  font-size: 22px;
  line-height: 33px;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  user-select: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.hidden { display: none !important; }

* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

html, body, #view { touch-action: none; overscroll-behavior: none; }
* { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.touch-only { display: none; }
body.touch .touch-only { display: revert; }
body.touch .mouse-only { display: none; }
body.touch #crosshair { opacity: 0.5; }

#stick {
  position: absolute;
  width: 112px;
  height: 112px;
  transform: translate(-50%, -50%);
  background: rgba(233, 220, 194, 0.08);
  box-shadow: 0 0 0 4px rgba(233, 220, 194, 0.18);
  pointer-events: none;
}
#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  background: rgba(232, 194, 122, 0.45);
  box-shadow: 0 0 0 4px rgba(232, 194, 122, 0.25);
}

#pause-button {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  pointer-events: auto;
  background:
    linear-gradient(rgba(233, 220, 194, 0.7), rgba(233, 220, 194, 0.7)) 12px 10px / 6px 24px no-repeat,
    linear-gradient(rgba(233, 220, 194, 0.7), rgba(233, 220, 194, 0.7)) 26px 10px / 6px 24px no-repeat;
}

#songs { display: none; }
body.touch #songs { display: flex; justify-content: space-between; color: var(--accent); }
#songs span { padding: 4px 6px; cursor: pointer; }

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.6) 100%);
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  box-sizing: border-box;
  text-shadow: 3px 3px 0 var(--shade);
}

#title {
  background: radial-gradient(ellipse at center, rgba(3, 2, 8, 0.15) 30%, rgba(3, 2, 8, 0.8) 100%);
  cursor: pointer;
}

h1 {
  margin: 0 0 48px;
  font-size: 44px;
  line-height: 55px;
  font-weight: 400;
  text-shadow: 5px 5px 0 var(--shade);
}

#title-art, #keys-art {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 28px rgba(255, 170, 80, 0.22));
}
.keys { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); opacity: 0.85; }
#keys-art { filter: none; }
.keys-inline b { font-weight: 400; margin: 0 0.5em 0 1em; }
.keys-inline b:first-child { margin-left: 0; }
.keys-inline { margin-left: auto; opacity: 0.7; }
.keys-inline b { color: var(--paper-ink); }

#pause { background: rgba(3, 2, 8, 0.6); }

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, 100%);
  padding: 28px;
  box-sizing: border-box;
  background: rgba(12, 10, 18, 0.88);
  box-shadow: 0 0 0 4px rgba(233, 220, 194, 0.1), 8px 8px 0 4px rgba(0, 0, 0, 0.4);
  text-align: left;
}
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel input[type="range"] { width: 55%; accent-color: var(--accent); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  background: rgba(255, 250, 235, 0.75);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}
#card {
  position: absolute;
  left: 50%;
  bottom: 9%;
  width: min(760px, calc(100% - 32px));
  max-height: 72vh;
  overflow: hidden;
  box-sizing: border-box;
  padding: 22px 26px 16px;
  background: rgba(228, 212, 176, 0.93);
  color: var(--paper-ink);
  box-shadow: 0 0 0 4px rgba(120, 92, 58, 0.9), 0 0 40px 6px rgba(255, 170, 80, 0.18), 8px 8px 0 4px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, 12px) rotate(-0.5deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#card.visible { opacity: 1; transform: translate(-50%, 0) rotate(-0.5deg); }
#card-text { white-space: pre-wrap; overflow-wrap: anywhere; }
#card-text .mail { color: var(--mail-ink); }
#toast {
  position: fixed;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 16px;
  background: rgba(16, 14, 24, 0.55);
  text-align: center;
  text-shadow: 2px 2px 0 var(--shade);
  pointer-events: none;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(3, 2, 8, 0.55);
}

.paper {
  width: min(760px, 100%);
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 30px 34px 22px;
  background: var(--paper);
  color: var(--paper-ink);
  transform: rotate(-0.6deg);
  box-shadow: 0 0 0 4px #c9b68e, 0 0 0 8px var(--wood), 10px 10px 0 8px rgba(0, 0, 0, 0.3);
  user-select: text;
}

#writer-text {
  display: block;
  width: 100%;
  min-height: 198px;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  color: inherit;
  background: repeating-linear-gradient(transparent 0 32px, rgba(74, 61, 44, 0.18) 32px 33px);
  background-attachment: local;
}
#writer-text::placeholder { color: rgba(74, 61, 44, 0.45); }

.row { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
#writer-count { opacity: 0.55; }
