:root {
  color-scheme: dark;
  --app-chrome: #0c0b10;
  --bg: #0c0b10;
  --panel: #14131a;
  --panel-soft: #1a1820;
  --ink: #f0eadf;
  --muted: #9b95a4;
  --line: rgba(231, 220, 199, 0.16);
  --violet: #9d7bd8;
  --red: #9d3f46;
  --paper: #d7c9ad;
  --safe-top: max(16px, var(--tg-content-safe-area-inset-top, env(safe-area-inset-top)));
  --safe-right: max(16px, var(--tg-content-safe-area-inset-right, env(safe-area-inset-right)));
  --safe-bottom: max(18px, var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom)));
  --safe-left: max(16px, var(--tg-content-safe-area-inset-left, env(safe-area-inset-left)));
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(126, 91, 171, 0.15), transparent 31rem),
    radial-gradient(circle at 86% 82%, rgba(125, 41, 50, 0.16), transparent 28rem),
    linear-gradient(145deg, #0d0c11 0%, #111016 50%, #09090c 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
}

body::before {
  inset: 0;
  opacity: 0.13;
  background:
    repeating-linear-gradient(108deg, transparent 0 10px, rgba(255, 255, 255, 0.055) 11px, transparent 12px),
    repeating-linear-gradient(17deg, transparent 0 26px, rgba(0, 0, 0, 0.25) 27px, transparent 28px);
  mix-blend-mode: screen;
}

body::after {
  width: min(78vw, 760px);
  aspect-ratio: 1;
  top: -34vw;
  right: -26vw;
  border: 1px solid rgba(196, 174, 220, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgba(169, 130, 198, 0.018),
    0 0 0 8rem rgba(169, 130, 198, 0.012);
}

a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1020px, 100%);
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 3.5rem)
    var(--safe-right)
    var(--safe-bottom)
    var(--safe-left);
  display: flex;
  flex-direction: column;
}

.brand-block {
  position: relative;
  max-width: 760px;
  margin-bottom: clamp(2.8rem, 8vw, 5.5rem);
  padding-left: clamp(0rem, 7vw, 6.5rem);
}

.brand-seal {
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 5rem;
  height: 5rem;
  display: none;
  place-items: center;
  border: 1px solid rgba(183, 152, 218, 0.42);
  border-radius: 50%;
  transform: rotate(-11deg);
}

.brand-seal::before,
.brand-seal::after,
.brand-seal span {
  content: "";
  position: absolute;
  width: 2.7rem;
  height: 1px;
  background: rgba(183, 152, 218, 0.58);
}

.brand-seal::before { transform: rotate(32deg); }
.brand-seal::after { transform: rotate(-32deg); }
.brand-seal span:nth-child(1) { transform: rotate(90deg); }
.brand-seal span:nth-child(2) { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.brand-seal span:nth-child(3) { width: 1.8rem; height: 1.8rem; border: 1px solid rgba(183, 152, 218, 0.28); border-radius: 50%; background: transparent; }

.system-line,
.card-kicker,
.footer-code {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.system-line {
  margin: 0 0 1.1rem;
  color: #afa5bc;
}

.pulse {
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: #b28ad9;
  box-shadow: 0 0 0 0.25rem rgba(178, 138, 217, 0.08), 0 0 1rem rgba(178, 138, 217, 0.55);
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 12vw, 7.2rem);
  font-weight: 400;
  letter-spacing: -0.075em;
  line-height: 0.86;
}

.brand-subtitle {
  max-width: 37rem;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-style: italic;
}

.main-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.menu-card {
  position: relative;
  min-height: 19rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(145deg, rgba(32, 29, 39, 0.93), rgba(17, 16, 21, 0.96));
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.24);
  text-decoration: none;
  isolation: isolate;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.menu-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 180ms ease;
}

.characters-card::before {
  background: radial-gradient(circle at 78% 28%, rgba(131, 95, 179, 0.25), transparent 45%);
}

.diary-card::before {
  background: radial-gradient(circle at 78% 28%, rgba(149, 65, 62, 0.24), transparent 45%);
}

.menu-card:hover,
.menu-card:focus-visible,
.menu-card.is-pressed {
  transform: translateY(-4px);
  border-color: rgba(225, 208, 234, 0.38);
}

.menu-card:hover::before,
.menu-card:focus-visible::before,
.menu-card.is-pressed::before {
  opacity: 1;
}

.card-index {
  align-self: flex-start;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.card-art {
  position: absolute;
  top: 1.5rem;
  right: 1rem;
  width: 48%;
  height: 48%;
  opacity: 0.58;
}

.card-art-characters i {
  position: absolute;
  bottom: 0;
  width: 28%;
  height: 70%;
  border: 1px solid rgba(196, 168, 225, 0.62);
  border-radius: 50% 50% 12% 12% / 19% 19% 8% 8%;
  background: linear-gradient(rgba(165, 130, 199, 0.12), transparent);
}

.card-art-characters i::before {
  content: "";
  position: absolute;
  width: 54%;
  aspect-ratio: 1;
  left: 23%;
  top: -24%;
  border: 1px solid rgba(196, 168, 225, 0.62);
  border-radius: 50%;
  background: #17151d;
}

.card-art-characters i:nth-child(1) { left: 4%; transform: scale(0.82); opacity: 0.55; }
.card-art-characters i:nth-child(2) { left: 36%; height: 82%; z-index: 2; }
.card-art-characters i:nth-child(3) { left: 68%; transform: scale(0.82); opacity: 0.55; }

.card-art-diary {
  border: 1px solid rgba(218, 190, 151, 0.48);
  background:
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(218, 190, 151, 0.11) 13px, transparent 14px),
    linear-gradient(145deg, rgba(221, 201, 166, 0.14), rgba(90, 50, 45, 0.08));
  transform: rotate(5deg);
  box-shadow: -0.65rem 0.7rem 0 rgba(119, 48, 48, 0.09);
}

.card-art-diary::after {
  content: "???";
  position: absolute;
  right: 10%;
  bottom: 12%;
  color: rgba(194, 98, 96, 0.75);
  font-family: "Bradley Hand", "Segoe Print", cursive;
  font-size: 1.25rem;
  transform: rotate(-8deg);
}

.scribble-one,
.scribble-two {
  position: absolute;
  left: 16%;
  top: 20%;
  width: 58%;
  height: 1px;
  background: rgba(221, 206, 178, 0.55);
  box-shadow: 0 0.7rem rgba(221, 206, 178, 0.36), 0 1.4rem rgba(221, 206, 178, 0.24);
  transform: rotate(-8deg);
}

.scribble-two {
  top: 58%;
  left: 8%;
  width: 44%;
  transform: rotate(12deg);
}

.card-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.45rem;
}

.card-kicker {
  color: #a89bae;
}

.card-copy strong {
  max-width: 11ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 0.98;
}

.card-copy > span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
}

.card-arrow {
  position: absolute;
  right: 1.35rem;
  bottom: 1.25rem;
  color: #c4b5cc;
  font-size: 1.35rem;
}

.app-footer {
  margin-top: auto;
  padding-top: clamp(2.5rem, 8vw, 5rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #77717e;
  font-size: 0.76rem;
}

.footer-code {
  text-align: right;
}

.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.back-link::before {
  content: "←";
  color: var(--ink);
  font-size: 1rem;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--ink);
}

@media (min-width: 720px) {
  .brand-seal { display: grid; }
}

@media (max-width: 680px) {
  .app-shell {
    padding-top: calc(var(--safe-top) + 2rem);
  }

  .main-menu {
    grid-template-columns: 1fr;
  }

  .menu-card {
    min-height: 13.75rem;
  }

  .card-art {
    width: 42%;
    height: 45%;
  }
}

@media (max-width: 420px) {
  .app-footer {
    align-items: flex-end;
  }

  .app-footer > span:first-child {
    max-width: 9rem;
  }
}

@media (hover: none), (max-width: 680px) {
  body::before, body::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
