/* Elden Ring text RPG — browser styling.
   Goals: high contrast, readable at any width, fully keyboard/touch operable,
   and respectful of reduced-motion and large-text preferences. */

:root {
  --bg: #0d0b07;
  --panel: #16130c;
  --panel-edge: #3a3015;
  --ink: #ece4d0;        /* primary text */
  --ink-dim: #b9ad8e;    /* secondary text */
  --gold: #e8c873;       /* accent */
  --gold-strong: #f3d98a;
  --focus: #8fd0ff;      /* high-contrast focus ring */
  --btn: #221c10;
  --btn-edge: #6b5a2a;
  --maxw: 80ch;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #1c1709 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* ---- Accessibility helpers ---- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 0.5rem; top: -3rem;
  background: var(--gold);
  color: #1a1408;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  z-index: 10;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Layout ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--panel-edge);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.2rem);
  color: var(--gold-strong);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
}
.subtitle { color: var(--ink-dim); font-size: 0.6em; font-style: italic; }

main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem);
}

.site-footer {
  border-top: 1px solid var(--panel-edge);
  padding: 1rem clamp(1rem, 4vw, 2rem);
  color: var(--ink-dim);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  text-align: center;
}
a { color: var(--gold); }

/* ---- Start screen ---- */
.start h2 {
  color: var(--gold-strong);
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  margin-top: 0;
}
.start h3 { color: var(--gold); }
.start ul { padding-left: 1.2rem; }
.start li { margin-bottom: 0.5rem; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--btn);
  border: 1px solid var(--btn-edge);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.05em 0.45em;
  font-size: 0.85em;
}

/* ---- Game screen ---- */
.screen {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1rem;
  line-height: 1.7;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: clamp(0.8rem, 3vw, 1.5rem);
  min-height: 44vh;
  max-height: 64vh;
  overflow-y: auto;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
}

.prompt {
  margin: 0.9rem 0 0.4rem;
  color: var(--gold);
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  font-style: italic;
  min-height: 1.4em;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.quick:empty { margin-bottom: 0; }

.input-form {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.cmd {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #0a0805;
  border: 1px solid var(--btn-edge);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.cmd:focus { border-color: var(--focus); }

/* ---- Buttons ---- */
button { font-family: system-ui, sans-serif; cursor: pointer; }

.primary-btn {
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  color: #1a1408;
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid #b8923a;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  min-height: 44px;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { filter: brightness(0.95); }

.ghost-btn {
  background: var(--btn);
  color: var(--gold);
  border: 1px solid var(--btn-edge);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  min-height: 40px;
  font-size: 0.95rem;
}
.ghost-btn:hover { border-color: var(--gold); }

.quick-btn {
  background: var(--btn);
  color: var(--ink);
  border: 1px solid var(--btn-edge);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  font-size: 0.95rem;
  max-width: 100%;
}
.quick-btn:hover { border-color: var(--gold); color: var(--gold-strong); }
.quick-btn:active { background: #2c2412; }

@media (max-width: 480px) {
  .quick-btn { flex: 1 1 100%; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Honor the OS "increase contrast" setting. */
@media (prefers-contrast: more) {
  :root { --ink: #fff; --ink-dim: #ddd; --panel-edge: #8a7430; }
}
