/* Clean, spacious game UI — single column, large targets, subtle motion */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Space+Mono:wght@700&display=swap');

:root {
  /* Palette — calm game vibe */
  --bg: #1b1020; /* deep plum */
  --bg-soft: #24122b; /* card surface */
  --bg-soft-2: #2b1633; /* input surface */
  --text: #efeaf2;
  --muted: #c4b8cc;
  --primary: #9e7bff; /* lavender */
  --primary-600: #7c5de6;
  --accent: #f1c27d; /* warm accent for highscore */
  --success: #3c8628;
  --danger: #ff6b7a;

  /* Layout / type scale */
  --radius-xl: 24px;
  --radius: 14px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px rgba(158, 123, 255, 0.35);

  --fs-1: clamp(1.6rem, 1.3rem + 0.6vw, 2rem);
  --fs-2: clamp(2.6rem, 2rem + 1.4vw, 4.2rem); /* title */
  --fs-num: clamp(4rem, 3.2rem + 4vw, 7.2rem); /* big number */
  --space-1: 0.75rem;
  --space-2: 1.2rem;
  --space-3: 1.8rem;
  --space-4: 2.4rem;
  --space-5: 3.2rem;
  --space-6: 4.8rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 62.5%;
  overflow: hidden;
}
body {
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(
      1200px 800px at 50% -10%,
      #2b1633 10%,
      transparent 60%
    ),
    radial-gradient(900px 600px at 10% 110%, #24122b 10%, transparent 60%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  line-height: 1.55;
  overflow: hidden;
}

/* Centered, portrait card */
main {
  width: 100%;
  display: grid;
  place-items: center;
}

.game {
  width: min(520px, 92%);
  height: min(96vh, 785px);
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg-soft-2));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  position: relative;
}

/* Top-right Again button */

/* Title & subtitle */
.title {
  font-weight: 600;
  font-size: var(--fs-2);
  letter-spacing: 0.06em;
  text-align: center;
}
.subtitle {
  font-size: 1.4rem;
  color: var(--muted);
  text-align: center;
}

/* Big number badge */
.number {
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
  font-size: clamp(3.6rem, 3rem + 3vw, 6.2rem);
  color: #1c0f22;
  background: #fff;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 100%;
  box-shadow: 0 10px 38px rgba(0, 0, 0, 0.45);
  transform: translateY(6px);
  transition: transform 0.25s ease, background-color 0.25s ease,
    color 0.25s ease;
}

/* Input + button stack (single column, spacious) */
.stack {
  width: 100%;
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.guess {
  background: #1e1225;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: clamp(2.2rem, 1.8rem + 0.9vw, 3.2rem);
  padding: 1.8rem 2rem;
  border-radius: 16px;
  outline: none;
  width: 100%;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.guess::placeholder {
  color: #9a8aa7;
}
.guess:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.btn {
  border: none;
  cursor: pointer;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 1.6rem 2rem;
  border-radius: 16px;
  transition: transform 0.06s ease, background-color 0.2s ease,
    box-shadow 0.2s ease;
  user-select: none;
}
.btn-instructions {
  border: none;
  cursor: pointer;
  font-size: 1.6rem;
  font-weight: 700;
  padding: 1.6rem 2rem;
  border-radius: 16px;
  transition: transform 0.06s ease, background-color 0.2s ease,
    box-shadow 0.2s ease;
  user-select: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  color: #111;
  box-shadow: 0 8px 22px rgba(158, 123, 255, 0.35);
}
.btn-primary:hover {
  background: var(--primary-600);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Status message */
.message {
  min-height: 4.6rem;
  width: 100%;
  font-size: 1.7rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 1.6rem 2rem;
  margin-top: var(--space-2);
  align-items: center;
}

/* Badges */
.badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: auto;
}
.badge {
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
}
.badge-accent {
  background: rgba(241, 194, 125, 0.2);
  border-color: rgba(241, 194, 125, 0.5);
}

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

body.win .number {
  background: linear-gradient(180deg, #b59cff, #9e7bff);

  color: #1c0f22;

  box-shadow: 0 0 14px rgba(158, 123, 255, 0.45);

  transform: scale(1.08);
  transition: all 0.3s ease;
}
body.win .message {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent);
  transition: all 0.3s ease;
}
body.lose .number {
  background: var(--danger);
  color: #fff;
}

.show-modal {
  font-size: 1.6rem;
  font-weight: 700;
  padding: 1.2rem 1.6rem;
  border-radius: 14px;
  cursor: pointer;

  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.show-modal:hover {
  background: rgba(255, 255, 255, 0.06);
}

.close-modal {
  position: absolute;
  top: 1.2rem;
  right: 1.6rem;

  width: 40px;
  height: 40px;
  border-radius: 12px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);

  cursor: pointer;
  font-size: 2.4rem;
}

.close-modal:hover {
  border-color: rgba(241, 194, 125, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

/* CLASSES TO MAKE MODAL WORK */
.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(650px, 92%);
  height: min(78vh, 750px);
  max-height: 92vh;
  overflow-y: auto;

  padding: 4rem 3rem 3rem 3.6rem;
  border-radius: var(--radius-xl);

  background: linear-gradient(180deg, var(--bg-soft), var(--bg-soft-2));
  color: var(--text);

  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  z-index: 10001;
}

.modal h2 {
  font-size: 2.6rem;
  margin-bottom: 2rem;
  text-align: center;
  align-items: center;
}

.modal p,
.modal li {
  font-size: 1.7rem;
  line-height: 1.65;
}

.modal ol {
  margin: 2.4rem auto;
  padding: 0;
  width: 85%;
  list-style-position: inside;
}

.modal li {
  margin-bottom: 1.8rem;
  font-size: 1.8rem;
  line-height: 1.7;
}

.modal li:last-child {
  margin-bottom: 0;
}

.modal li {
  text-align: left;
}

.modal .rules {
  width: 70%;
  margin: 3rem auto 0 auto;
  padding: 0;
  list-style-position: inside;
}

.modal .rules li {
  margin-bottom: 2rem;
  font-size: 1.8rem;
  line-height: 1.7;
}

.overlay {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  z-index: 10000;
}
