:root {
  --bg: #000;
  --text: #f4ecd8;
  --mute: rgba(244, 236, 216, 0.58);
  --line: rgba(244, 236, 216, 0.14);
  --ui: "IBM Plex Sans Arabic", Tahoma, sans-serif;
  --lit: "Amiri", "Noto Naskh Arabic", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: var(--ui);
  direction: rtl;
  overflow: hidden;
  touch-action: none;
}

button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }

#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 26px;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-family: var(--lit);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0;
  line-height: 1.1;
}

.brand span {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mute);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--mute);
}

#btn-sound[aria-pressed="false"] {
  opacity: 0.55;
}

.hud-actions button,
.sheet-bar button,
.intro button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  color: var(--text);
  padding: 9px 16px;
  font-size: 13px;
  border-radius: 999px;
}

.hud-actions button:hover,
.sheet-bar button:hover,
.intro button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  width: min(520px, calc(100% - 32px));
  text-align: center;
  font-size: 13px;
  font-weight: 300;
  color: var(--mute);
  pointer-events: none;
  text-shadow: 0 8px 24px #000;
}

.hover-label {
  position: fixed;
  z-index: 6;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -140%);
  white-space: nowrap;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(70, 50, 120, 0.22), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(20, 40, 90, 0.28), transparent 45%),
    rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
}

.sheet[hidden] { display: none !important; }

.sheet-inner {
  width: min(640px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  padding: 36px 32px 28px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 14, 28, 0.78), rgba(4, 6, 14, 0.86));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  position: relative;
}

.sheet-x {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--mute);
}

.sheet-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.12em;
}

.sheet h2 {
  font-family: var(--lit);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 18px;
  line-height: 1.45;
}

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--mute);
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: rgba(244, 236, 216, 0.4);
}

textarea {
  font-family: var(--lit);
  font-size: 22px;
  line-height: 2;
  min-height: 220px;
  resize: vertical;
  color: var(--text);
}

.form-msg {
  min-height: 1.2em;
  color: #e7a39a;
  font-size: 13px;
}

.sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--mute);
  font-size: 12px;
}

.read-date {
  margin: -8px 0 22px;
  color: var(--mute);
  font-size: 13px;
}

.read-body {
  font-family: var(--lit);
  font-size: 22px;
  line-height: 2.15;
  margin: 0 0 28px;
  white-space: pre-wrap;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15), rgba(0,0,0,0.55) 70%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
  padding: 24px;
}

.intro.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-en {
  letter-spacing: 0.42em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--mute);
  margin: 0 0 8px;
}

.intro h1 {
  font-family: var(--lit);
  font-size: clamp(48px, 10vw, 84px);
  font-weight: 700;
  margin: 0 0 12px;
}

.intro-lead {
  max-width: 26em;
  margin: 0 auto 28px;
  font-family: var(--lit);
  font-size: 20px;
  line-height: 2;
  color: var(--mute);
}

.intro-err { color: #e7c98a; }

.intro button {
  padding: 12px 28px;
  font-size: 14px;
}

.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translate(-50%, 10px);
  z-index: 30;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--line);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 700px) {
  .duo { grid-template-columns: 1fr; }
  .sheet-inner { padding: 32px 18px 22px; }
  .hud { padding: 16px; }
  .brand strong { font-size: 22px; }
  .hint { bottom: 16px; font-size: 12px; }
}
