:root {
  --bg: #14110e;
  --card: #221c16;
  --ink: #f4efe6;
  --muted: #b5a898;
  --line: #3d342c;
  --accent: #ff5a36;
  --ok: #d6f25c;
  --header: rgba(20, 17, 14, 0.94);
  --dock-h: 64px;
  --pad: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(800px 320px at 0% 0%, #4a2418 0%, transparent 55%),
    var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  line-height: 1.45;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--ok); text-decoration: none; }
code, .break, .sub-link { overflow-wrap: anywhere; word-break: break-word; }

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding:
    calc(12px + env(safe-area-inset-top))
    var(--pad)
    calc(28px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 calc(var(--pad) * -1) 8px;
  padding: 10px var(--pad);
  background: var(--header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}
.mark {
  font-family: Palatino, Georgia, serif;
  letter-spacing: 0.16em;
  font-size: 13px;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-toggle {
  display: none;
  min-height: 44px;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.nav {
  display: flex;
  gap: 6px 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a {
  color: var(--muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 4px 2px;
}
.nav a.here { color: var(--ok); }
.nav .button { color: #1c0d09; min-height: 44px; }

h1 {
  font-family: Palatino, Georgia, serif;
  font-weight: 500;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 0.96;
  margin: 18px 0 12px;
  overflow-wrap: anywhere;
}
h2 { font-size: 1.25rem; margin: 0 0 10px; }
.lead { max-width: 640px; color: var(--muted); font-size: 18px; }
.muted, p.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 20px;
}
.stats { margin-top: 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  min-width: 0;
}
.price { font-family: Palatino, Georgia, serif; font-size: clamp(28px, 4vw, 36px); }
.narrow { width: min(480px, 100%); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #1c0d09;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .button, .actions button { flex: 1 1 160px; }

input, select, textarea {
  width: 100%;
  max-width: 100%;
  margin: 6px 0 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #100e0c;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
label { color: var(--muted); font-size: 13px; display: block; }
.error { color: #ffb4a4; }
.section { margin-top: 22px; }
.sub-link { display: inline-block; max-width: 100%; font-size: 14px; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

.stack-forms form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.stack-forms button { flex: 0 0 auto; }

.dock {
  display: none;
}

@media (min-width: 700px) {
  :root { --pad: 22px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .actions .button, .actions button { flex: 0 1 auto; }
}

@media (min-width: 1100px) {
  :root { --pad: 28px; }
  .wrap { padding-top: 20px; padding-bottom: 72px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top { border-bottom-color: transparent; background: transparent; backdrop-filter: none; position: static; }
}

@media (min-width: 700px) and (max-width: 1099px) {
  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: none;
    overflow: visible;
  }
  .nav a, .nav .button { white-space: nowrap; }
}

@media (max-width: 699px) {
  .nav-toggle { display: inline-flex; }
  .top { border-bottom-color: var(--line); }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px 14px;
    background: #1b1612;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  body.nav-open .nav { display: flex; }
  .nav a, .nav .button {
    white-space: normal;
    justify-content: flex-start;
    width: 100%;
    padding: 10px 8px;
    border-radius: 12px;
  }
  .nav .button { justify-content: center; }
  .actions .button, .actions button { flex: 1 1 100%; }
  h1 { font-size: clamp(28px, 9vw, 36px); }

  .wrap { padding-bottom: calc(var(--dock-h) + 18px + env(safe-area-inset-bottom)); }
  .dock {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    min-height: var(--dock-h);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(20, 17, 14, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .dock a, .dock button {
    appearance: none;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-radius: 12px;
    min-height: 48px;
    padding: 6px 2px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.15;
  }
  .dock a.here, .dock button[aria-expanded="true"] { color: var(--ok); }

  table.responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td {
    display: block;
    width: 100%;
  }
  table.responsive tr {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    margin: 0 0 12px;
    padding: 6px 14px 10px;
  }
  table.responsive td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 12px;
    border: 0;
    padding: 8px 0;
  }
  table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
  table.responsive td:has(form),
  table.responsive td:has(button) {
    flex-direction: column;
    align-items: stretch;
  }
  .stack-forms form { flex-direction: column; align-items: stretch; }
}

@media (max-height: 480px) {
  .dock { display: none; }
  .wrap { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
