:root {
  --navy: #12203a;
  --navy-2: #1b2d4f;
  --gold: #c9a24c;
  --gold-soft: #e6cf8f;
  --parchment: #f7f0e1;
  --parchment-2: #efe4cc;
  --ink: #2a2116;
  --ink-soft: #6b5a41;
  --wine: #7a2335;
  --done: #2f6b4f;
  --radius: 14px;
  --serif: "EB Garamond", "Frank Ruhl Libre", Georgia, serif;
  --hebrew: "Frank Ruhl Libre", "David", "Times New Roman", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, #2a3f68 0%, transparent 70%),
    repeating-linear-gradient(45deg, rgba(201,162,76,.035) 0 2px, transparent 2px 14px),
    var(--navy);
  color: var(--parchment);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.45;
}
.bh {
  position: absolute; top: 12px; right: 18px;
  font-family: var(--hebrew); color: var(--gold-soft); font-size: 15px; opacity: .85;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px 120px; }

/* Header */
header.masthead { text-align: center; padding: 28px 0 8px; }
.hebrew-title {
  font-family: var(--hebrew); font-weight: 700; color: var(--gold);
  font-size: clamp(34px, 6vw, 54px); letter-spacing: .02em; margin: 0;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.title {
  margin: 2px 0 6px; font-size: clamp(20px, 3vw, 26px); font-weight: 500;
  letter-spacing: .28em; text-transform: uppercase; color: var(--gold-soft);
}
.subtitle { color: #c8bfae; font-style: italic; margin: 0; }
.ornament { display: block; margin: 16px auto 4px; width: min(420px, 80%); height: 22px; color: var(--gold); }

.userbar {
  display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; align-items: center;
  font-size: 15px; color: #c8bfae; margin: 8px 0 22px;
}
.userbar a { color: var(--gold-soft); }

/* Buttons */
button, .btn {
  font: inherit; cursor: pointer; border-radius: 999px;
  border: 1px solid var(--gold); background: transparent; color: var(--gold-soft);
  padding: 6px 16px; font-size: 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
button:hover, .btn:hover { background: rgba(201,162,76,.15); }
button:focus-visible, input:focus-visible, textarea:focus-visible, .check:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.solid, button.solid { background: var(--gold); color: var(--navy); font-weight: 600; }
.btn.solid:hover, button.solid:hover { background: var(--gold-soft); }
button.music.on { background: var(--gold); color: var(--navy); }

/* Date bar */
.datebar {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px;
}
.datebar .dates { text-align: center; min-width: 220px; }
.datebar .greg { font-size: 22px; color: var(--parchment); }
.datebar .heb { font-family: var(--hebrew); color: var(--gold-soft); font-size: 18px; }
.datebar button { width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 20px; }
.today-link { font-size: 14px; }

/* Cards */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.card {
  position: relative;
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  color: var(--ink); border-radius: var(--radius); padding: 22px 22px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 1px rgba(122,90,30,.25);
}
.card::before {
  content: ""; position: absolute; inset: 7px; border-radius: calc(var(--radius) - 5px);
  border: 1px solid rgba(160,120,40,.45); pointer-events: none;
}
.card h2 {
  margin: 0 0 4px; font-size: 24px; font-weight: 600; color: var(--navy);
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.card h2 .he { font-family: var(--hebrew); color: var(--wine); font-size: 22px; }
.card .lead { margin: 0 0 14px; color: var(--ink-soft); font-size: 15px; }
.span-2 { grid-column: 1 / -1; }

/* Tefillah */
.tefillah-top { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.ring { width: 96px; height: 96px; flex: none; }
.ring .track { stroke: rgba(122,90,30,.18); }
.ring .bar { stroke: var(--gold); transition: stroke-dashoffset .5s ease; }
.ring text { font-family: var(--serif); fill: var(--navy); }
.tefillah-msg { font-size: 17px; color: var(--ink); }
.tefillah-msg strong { color: var(--wine); }
.tef-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tef {
  border: 1px solid rgba(122,90,30,.35); border-radius: 12px; background: rgba(255,255,255,.5);
  color: var(--ink); padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 16px; border-radius: 12px;
}
.tef .he { font-family: var(--hebrew); font-size: 20px; color: var(--wine); }
.tef .time { font-size: 12px; color: var(--ink-soft); }
.tef[aria-pressed="true"] { background: var(--navy); color: var(--parchment); border-color: var(--navy); }
.tef[aria-pressed="true"] .he { color: var(--gold); }
.tef[aria-pressed="true"] .time { color: var(--gold-soft); }
.tef:hover { background: rgba(201,162,76,.2); }
.tef[aria-pressed="true"]:hover { background: var(--navy-2); }

/* Checklist */
.counter { font-size: 15px; color: var(--ink-soft); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.45); border: 1px solid rgba(122,90,30,.18);
}
.check:hover { background: rgba(255,255,255,.75); }
.check label { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box {
  width: 24px; height: 24px; flex: none; border-radius: 6px; border: 1.5px solid var(--gold);
  display: grid; place-items: center; background: #fffaf0; transition: background .15s;
}
.box svg { width: 16px; height: 16px; opacity: 0; transition: opacity .15s; }
.check input:checked + .box { background: var(--navy); border-color: var(--navy); }
.check input:checked + .box svg { opacity: 1; }
.check .names { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.check .he { font-family: var(--hebrew); color: var(--wine); font-size: 15px; }
.check.done .en { color: var(--done); }
.check .del {
  border: none; color: var(--ink-soft); padding: 2px 8px; font-size: 18px; border-radius: 6px;
}
.check .del:hover { background: rgba(122,35,53,.12); color: var(--wine); }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid rgba(122,90,30,.4); background: #fffaf0; color: var(--ink);
}
.add-row button { border-color: var(--navy); color: var(--navy); }
.add-row button:hover { background: rgba(18,32,58,.08); }

/* Notes */
textarea {
  width: 100%; min-height: 150px; resize: vertical; font: inherit; font-size: 17px; color: var(--ink);
  border: 1px solid rgba(122,90,30,.35); border-radius: 10px; padding: 12px 14px;
  background:
    repeating-linear-gradient(180deg, transparent 0 29px, rgba(122,90,30,.14) 29px 30px),
    #fffaf0;
  line-height: 30px;
}
.savestate { font-size: 14px; color: var(--ink-soft); min-height: 20px; margin-top: 6px; }

/* Week */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.wday {
  text-align: center; padding: 10px 4px; border-radius: 10px; background: rgba(255,255,255,.45);
  border: 1px solid rgba(122,90,30,.18); color: var(--ink); font-size: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 10px;
}
.wday.sel { outline: 2px solid var(--gold); }
.wday .dow { font-weight: 600; color: var(--navy); }
.wday .dots { display: flex; gap: 3px; }
.wday .dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--gold); }
.wday .dot.on { background: var(--gold); }
.wday .m { font-size: 12px; color: var(--ink-soft); }
.week-total { margin-top: 12px; font-size: 15px; color: var(--ink-soft); }

footer.foot { text-align: center; margin-top: 40px; color: #9c927f; font-size: 14px; }
.skyline { display: block; width: 100%; max-width: 980px; margin: 40px auto 0; height: 70px; color: rgba(201,162,76,.22); }

/* Signed-out page */
.welcome { max-width: 560px; margin: 40px auto 0; text-align: center; }
.welcome .card { text-align: center; padding: 34px 28px; }
.welcome .card p { color: var(--ink-soft); }
.welcome .btn.solid { margin-top: 10px; font-size: 18px; padding: 10px 26px; }

/* Who came to the tefillah */
.tef-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tef-wrap .tef { width: 100%; }
.who-btn {
  border: 1px dashed rgba(122,90,30,.5); color: var(--ink-soft); background: rgba(255,255,255,.35);
  border-radius: 10px; padding: 5px 6px; font-size: 13px; justify-content: center; min-height: 34px; flex-wrap: wrap; gap: 2px;
}
.who-btn:hover { background: rgba(201,162,76,.2); color: var(--ink); }
.who-btn .faces { display: inline-flex; }
.who-btn .faces svg {
  width: 24px; height: 24px; border-radius: 50%; background: #fffaf0; border: 1.5px solid var(--gold);
  padding: 2px; margin-left: -7px;
}
.who-btn .faces svg:first-child { margin-left: 0; }

.who-dlg {
  border: none; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2)); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 0 0 1px rgba(122,90,30,.3);
}
.who-dlg[open] { animation: pop .22s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } }
.who-dlg::backdrop { background: rgba(10,18,34,.7); backdrop-filter: blur(3px); }
.who-inner { padding: 22px; position: relative; }
.who-inner::before {
  content: ""; position: absolute; inset: 8px; border-radius: 12px; border: 1px solid rgba(160,120,40,.45); pointer-events: none;
}
.who-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.who-head h2 { margin: 0; font-size: 24px; color: var(--navy); }
.who-head .he { margin: 0; font-family: var(--hebrew); color: var(--wine); font-size: 20px; }
.who-head .x { border: none; color: var(--ink-soft); font-size: 26px; padding: 0 8px; line-height: 1; }
.who-tabs { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.who-tabs button { border-color: rgba(18,32,58,.4); color: var(--navy); font-size: 15px; padding: 4px 14px; }
.who-tabs button[aria-selected="true"] { background: var(--navy); color: var(--gold-soft); border-color: var(--navy); }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.person {
  position: relative; border-radius: 14px; border: 1.5px solid rgba(122,90,30,.3); background: #fffaf0;
  color: var(--ink); padding: 14px 8px 12px; flex-direction: column; gap: 6px; text-align: center;
  transition: transform .12s, background .15s, border-color .15s;
}
.person:hover { background: #fff; transform: translateY(-2px); }
.person .pic {
  width: 64px; height: 64px; border-radius: 50%; background: var(--parchment-2); display: grid; place-items: center;
  border: 2px solid var(--gold); padding: 6px;
}
.person .pic svg { width: 100%; height: 100%; }
.person .nm { font-weight: 600; font-size: 16px; line-height: 1.15; color: var(--navy); }
.person .tg { font-size: 13px; color: var(--ink-soft); }
.person .tick {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--navy); color: var(--gold-soft); display: grid; place-items: center; font-size: 14px;
  opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s;
}
.person[aria-pressed="true"] { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 2px var(--gold); }
.person[aria-pressed="true"] .tick { opacity: 1; transform: scale(1); }
.who-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; color: var(--ink-soft); font-size: 15px; }
.who-actions { display: flex; gap: 8px; }
.who-actions button { border-color: var(--navy); color: var(--navy); }
.who-actions button.solid { color: var(--navy); }

/* YouTube song player */
.player {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  width: min(360px, calc(100vw - 32px)); background: var(--navy-2); border: 1px solid var(--gold);
  border-radius: 14px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.player-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; font-size: 15px; color: var(--gold-soft); }
.player-head button { border: none; font-size: 22px; padding: 0 8px; }
.player-frame { aspect-ratio: 16 / 9; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Excuse Machine (inside "Who came?") */
.person-tile { display: flex; flex-direction: column; gap: 6px; }
.person-tile .person { flex: 1; width: 100%; }
.excuse-chip {
  border: 1px dashed rgba(122,35,53,.5); color: var(--wine); background: rgba(122,35,53,.06);
  border-radius: 10px; font-size: 13px; padding: 5px 8px; line-height: 1.25; text-align: left;
  justify-content: center; min-height: 32px;
}
.excuse-chip:hover { background: rgba(122,35,53,.12); }
.excuse-chip.has { justify-content: space-between; font-style: italic; }
.excuse-chip q { flex: 1; }
.excuse-chip .re { font-style: normal; }
.excuse-chip.spinning { font-style: italic; opacity: .85; }

/* Playlist controls */
.player-head { gap: 6px; padding: 6px 6px 6px 8px; }
.player-head select {
  flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--gold-soft); background: var(--navy);
  border: 1px solid rgba(201,162,76,.5); border-radius: 8px; padding: 4px 6px;
}
.player-head button { font-size: 18px; padding: 0 6px; }
.player-frame > div, .player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Borshtein's Kretchme */
.kretchme {
  margin-top: 28px; border-radius: var(--radius); padding: 26px clamp(16px, 3vw, 28px);
  background:
    radial-gradient(600px 220px at 50% 0, rgba(201,162,76,.22), transparent 70%),
    linear-gradient(180deg, #1a1222, #0d0a14);
  border: 1px solid rgba(201,162,76,.45);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
}
.marquee {
  text-align: center; padding: 16px 12px 18px; border-radius: 12px; position: relative;
  border: 2px solid var(--gold);
  background: repeating-linear-gradient(90deg, rgba(255,214,120,.95) 0 6px, transparent 6px 22px) top / 100% 6px no-repeat,
              repeating-linear-gradient(90deg, rgba(255,214,120,.95) 0 6px, transparent 6px 22px) bottom / 100% 6px no-repeat,
              #170f1f;
}
.kx-kicker { margin: 4px 0 0; color: var(--gold-soft); letter-spacing: .3em; text-transform: uppercase; font-size: 12px; }
.marquee h2 {
  margin: 2px 0; font-size: clamp(30px, 5.5vw, 48px); color: #ffe7a8; font-weight: 600; letter-spacing: .02em;
  text-shadow: 0 0 6px rgba(255,200,90,.8), 0 0 22px rgba(255,170,40,.45);
}
.kx-tonight { margin: 0; color: #e8d9b8; font-style: italic; }
.kx-h { color: var(--gold); font-size: 15px; letter-spacing: .2em; text-transform: uppercase; margin: 22px 0 12px; font-weight: 600; }

.lineup { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.act {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid rgba(201,162,76,.35); border-radius: 14px; padding: 14px 10px 12px;
  transition: transform .15s, border-color .15s;
}
.act:hover { transform: translateY(-3px); border-color: var(--gold); }
.act-pic {
  width: 74px; height: 74px; border-radius: 50%; background: var(--parchment); border: 2px solid var(--gold);
  display: grid; place-items: center; padding: 9px; margin-bottom: 6px;
  box-shadow: 0 0 16px rgba(255,190,80,.25);
}
.act-pic svg { width: 100%; height: 100%; }
.act-role { color: var(--gold); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.act-name { color: var(--parchment); font-size: 17px; font-weight: 600; line-height: 1.2; }
.act-aka { color: #c8bfae; font-style: italic; font-size: 14px; }

.kx-where { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; margin-top: 8px; align-items: start; }
@media (max-width: 760px) { .kx-where { grid-template-columns: 1fr; } }
.kx-map {
  aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; border: 1px solid rgba(201,162,76,.45);
  background: repeating-linear-gradient(45deg, rgba(201,162,76,.06) 0 10px, transparent 10px 20px), #120d18;
}
.kx-map:empty { display: grid; place-items: center; }
.kx-map:empty::after { content: "🗺️ Map appears once the address is saved"; color: #9c927f; font-style: italic; font-size: 15px; padding: 12px; text-align: center; }
.kx-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.kx-info .kx-h { margin-top: 0; }
.kx-addr { color: var(--parchment); font-size: 19px; margin: 0 0 12px; }
.kx-note { color: #c8bfae; font-size: 15px; margin: 0 0 10px; }
.kretchme details { margin-top: 12px; }
.kretchme summary { cursor: pointer; color: var(--gold-soft); font-size: 15px; }
.kretchme .add-row input { background: #fffaf0; }
.kretchme .add-row button.solid { color: var(--navy); border-color: var(--gold); }
.kx-about { color: #e8d9b8; font-size: 17px; text-align: center; max-width: 680px; margin: 16px auto 10px; }
.kx-tags { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.kx-tags li { border: 1px solid rgba(201,162,76,.45); color: var(--gold-soft); border-radius: 999px; padding: 3px 12px; font-size: 14px; }
.kx-venue { color: #ffe7a8; font-size: 24px; font-weight: 600; margin: 0; text-shadow: 0 0 10px rgba(255,190,80,.35); }
.kx-venue-sub { color: var(--gold-soft); font-style: italic; font-size: 15px; margin: 0 0 8px; }
.kx-play { text-align: center; margin: 14px 0 0; }
