html, body {
  background: #f5f5f5;
  color: #111;
}

:root {
  --bg: #f5f5f5;
  --ink: #111111;
  --muted: rgba(17, 17, 17, 0.62);
  --line: rgba(17, 17, 17, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--ink);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}
::selection { background: rgba(17, 17, 17, 0.16); }

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 24px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  -webkit-app-region: drag;
}

.bar-side,
.session,
.win-controls,
.win-controls button {
  -webkit-app-region: no-drag;
}

.bar-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.is-web .bar .win-controls { display: none; }
.win-controls { display: flex; gap: 6px; }

.win-controls button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.win-controls button svg { width: 12px; height: 12px; }
.win-controls .icon-restore { display: none; }
#win-max.is-max .icon-max { display: none; }
#win-max.is-max .icon-restore { display: block; }
.win-controls button:hover { background: #111; color: #fff; }
.win-controls .close:hover { background: #111; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.mark { width: 22px; height: 22px; fill: #111; }

.session {
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px 8px 4px;
}

.kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

h1 { font-size: clamp(40px, 4vw, 56px); }

.lede, .hint, .status {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.lede { max-width: 28rem; margin: 14px 0 8px; }
.hint, .status { min-height: 1.4em; margin: 0; }

label {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-transform: none;
}

input:focus { border-color: #111; outline: none; }

.code-row, .actions, .sheet-row, .dates {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.code-row label, .dates label { flex: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  padding: 12px 12px 12px 18px;
  white-space: nowrap;
  transition: background 200ms var(--ease), transform 150ms var(--ease);
}

.pill:hover { background: #2a2a2a; }
.pill:active { transform: scale(0.97); }
.pill:disabled { opacity: 0.45; cursor: not-allowed; }

.pill.ghost {
  background: transparent;
  color: #111;
  border: 1px solid var(--line);
  padding: 11px 18px;
}
.pill.ghost:hover { background: #fff; }

.arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
}
.arrow svg { width: 14px; height: 14px; }
.pill.ghost .arrow { display: none; }

.text-btn {
  border: 0;
  background: transparent;
  padding: 8px 2px;
  font-size: 13px;
  color: var(--muted);
}
.text-btn.danger { color: #111; }
.actions { flex-wrap: wrap; margin-top: 16px; }

.board {
  position: relative;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  background: #111;
  display: flex;
  flex-direction: column;
}

.film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.5s linear, transform 1.8s var(--ease);
}
.film.is-in { opacity: 1; transform: scale(1); }

.grain {
  position: absolute;
  inset: 0;
  height: 100%;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>");
}

.board::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.08) 62%, transparent 100%);
}

.board-copy {
  position: relative;
  z-index: 2;
  padding: 28px 28px 0;
  color: #fff;
  min-height: 168px;
}

.kicker.on-media { color: rgba(255, 255, 255, 0.72); }

h2 {
  font-size: clamp(48px, 5vw, 72px);
  color: #fff;
}
h2 em {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.78);
}

.sheet {
  position: relative;
  z-index: 3;
  margin-top: auto;
  background: #f5f5f5;
  border-radius: 28px 28px 0 0;
  padding: 18px 22px 16px;
  overflow: auto;
  max-height: 62%;
}

.combo { position: relative; }
.combo input { padding-right: 44px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: 0; }

.combo > button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: calc(100% - 12px);
  border: 0;
  border-radius: 8px;
  background: #f5f5f5;
  color: #111;
  display: grid;
  place-items: center;
}
.combo > button svg { width: 14px; height: 14px; }

.menu {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 180px;
  overflow: auto;
}

.menu li { display: grid; grid-template-columns: 1fr auto; }
.menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
.menu button:hover { background: #f5f5f5; }
.menu .remove { color: #111; }

.sheet-row { align-items: center; margin-top: 14px; }
.history-btn {
  padding: 8px 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 17, 17, 0.42);
}

.dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(720px, calc(100vh - 56px));
  overflow: auto;
  background: #f5f5f5;
  border-radius: 28px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.dialog h2 {
  color: #111;
  font-size: 40px;
}

#history-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

#history-close svg { width: 12px; height: 12px; }
#history-close:hover { background: #111; color: #fff; }

.dialog .dates { margin-top: 12px; }
.dialog .coupons { margin-top: 14px; }
.dates { margin-top: 8px; }

.coupons { display: grid; gap: 8px; margin-top: 10px; }

.coupon {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border-radius: 16px;
}

.amount {
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #111;
  color: #fff;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.coupon h3 { margin: 0 0 4px; font-size: 15px; font-weight: 500; letter-spacing: -0.02em; }
.coupon p { margin: 0; color: var(--muted); font-size: 13px; }
.coupon a { color: #111; font-size: 13px; }

.empty { color: var(--muted); font-size: 13px; padding: 8px 10px; }

.rise {
  animation: rise 0.8s var(--ease) both;
}
.delay { animation-delay: 0.12s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rise, .film { animation: none; transition: none; opacity: 1; transform: none; }
}

@media (max-width: 900px), (max-height: 720px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; }
  .board { min-height: 640px; }
}
