:root {
  --paper: #f3ead6;
  --paper-2: #efe3c8;
  --ink: #17352c;
  --ink-soft: #3d5a4f;
  --stamp: #c4492c;
  --gold: #b8893a;
  --line: rgba(23, 53, 44, 0.14);
  --shadow: 0 18px 40px rgba(23, 53, 44, 0.16);
  --sheet-max: 27.5rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #123028;
  color: var(--ink);
  font-family: Assistant, "Noto Sans Hebrew", "Arial Hebrew", "David", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}

.table {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255, 220, 150, 0.12), transparent 55%),
    repeating-linear-gradient(90deg, #0f281f 0 28px, #123028 28px 56px);
  opacity: 0.9;
}

.sheet {
  position: relative;
  width: min(var(--sheet-max), 100%);
  margin-inline: auto;
  min-height: calc(100dvh - 2rem);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 18%),
    var(--paper);
  border-radius: 1.75rem;
  box-shadow: var(--shadow);
  padding: 1.75rem 1.35rem 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  pointer-events: none;
}

.kicker {
  margin: 0;
  font-size: 0.95rem;
  color: var(--gold);
  font-weight: 700;
}

h1,
h2 {
  font-family: "Frank Ruhl Libre", "Times New Roman", "David Libre", serif;
  margin: 0.5rem 0 0.75rem;
  line-height: 1.2;
  font-weight: 700;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2rem, 7vw, 3rem);
}

h2 {
  font-size: clamp(1.45rem, 5vw, 2.1rem);
}

.lede,
.note {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.nikkud {
  font-family: "Frank Ruhl Libre", "Times New Roman", "David Libre", serif;
  font-size: clamp(2.4rem, 11vw, 4.2rem);
  line-height: 1.4;
  margin: 0.75rem 0 0.5rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.role-stamp {
  display: inline-block;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  border-radius: 8px;
  padding: 6px 14px;
  transform: rotate(-6deg);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--stamp);
  font: inherit;
  cursor: pointer;
  padding: 0;
  min-width: 1.75rem;
  min-height: 1.75rem;
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.topic {
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.topic[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fffaf0;
  border-radius: 14px;
  padding: 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}

button.primary,
button.ghost,
button.danger,
a.primary-link {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 3.1rem;
}

button.primary,
a.primary-link {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-top: 10px;
}

button.ghost[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

button.danger {
  background: var(--stamp);
  color: #fff8ef;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.cover {
  min-height: min(26rem, calc(100dvh - 6rem));
  display: grid;
  place-items: center;
  text-align: center;
}

.turn {
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--paper-2);
  border-radius: 1.1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.boot {
  text-align: center;
  color: var(--ink-soft);
}

.hint {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: rgba(196, 73, 44, 0.08);
  color: var(--stamp);
  border-radius: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.confirm-note {
  margin: 0.5rem 0 0;
  text-align: center;
  font-weight: 700;
  color: var(--stamp);
}

button.primary.add-btn {
  width: auto;
  min-width: 5.5rem;
  padding-inline: 18px;
  flex: 0 0 auto;
}

.row input[type="text"] {
  flex: 1 1 auto;
}

@media (min-width: 700px) {
  :root {
    --sheet-max: 36rem;
  }

  body {
    padding: 1.5rem;
  }

  .sheet {
    min-height: calc(100dvh - 3rem);
    padding: 2.25rem 2rem 1.75rem;
  }
}

@media (min-width: 1100px) {
  html {
    font-size: clamp(18px, 1.15vw + 10px, 28px);
  }

  :root {
    --sheet-max: 48rem;
  }

  body {
    padding: 1.5rem 2rem;
    overflow: hidden;
  }

  .sheet {
    min-height: calc(100dvh - 3rem);
    max-height: calc(100dvh - 3rem);
    padding: 2.25rem 2.5rem 1.75rem;
    border-radius: 2rem;
  }

  .nikkud {
    font-size: clamp(3.2rem, 6vw, 6.2rem);
  }

  h1 {
    font-size: clamp(2.6rem, 5vw, 4.8rem);
  }

  h2 {
    font-size: clamp(2rem, 3.6vw, 3.4rem);
  }
}

@media (min-width: 1600px) and (min-height: 860px) {
  html {
    font-size: clamp(22px, 1.35vw + 8px, 34px);
  }

  :root {
    --sheet-max: 56rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .sheet {
    min-height: calc(100dvh - 1rem);
    padding: 1rem 1.1rem;
  }

  .cover {
    min-height: calc(100dvh - 3rem);
  }

  h1 {
    font-size: 1.6rem;
  }

  .nikkud {
    font-size: 2rem;
    margin: 0.4rem 0;
  }
}

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