:root {
  --bg: #130d10;
  --panel: rgba(31, 23, 18, 0.92);
  --panel-strong: rgba(49, 35, 24, 0.96);
  --text: #f8efe5;
  --muted: #d6c2ab;
  --line: rgba(211, 173, 117, 0.16);
  --accent: #8f5c32;
  --accent-strong: #b9814f;
  --success: #6ec39b;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
  --parchment: #d7c09a;
  --parchment-deep: #c7ab82;
  --ink: #342116;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(122, 75, 34, 0.28), transparent 32%),
    radial-gradient(circle at right top, rgba(77, 30, 12, 0.22), transparent 26%),
    linear-gradient(180deg, #100b08 0%, #1a130f 52%, #0f0b08 100%);
}

a {
  color: #f0d3aa;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background:
    linear-gradient(180deg, rgba(38, 23, 14, 0.96), rgba(18, 12, 8, 0.94)),
    repeating-linear-gradient(
      90deg,
      rgba(122, 81, 46, 0.06) 0 60px,
      rgba(68, 45, 26, 0.12) 60px 66px
    );
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.brand {
  font-size: clamp(30px, 4vw, 42px);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: white;
  text-shadow: 0 0 18px rgba(255, 228, 188, 0.1);
}

.brand-wrap {
  display: grid;
  gap: 2px;
  text-decoration: none;
}

.brand-subtitle {
  color: #d4bb98;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(57, 36, 21, 0.72), rgba(31, 21, 13, 0.74));
  border: 1px solid rgba(190, 143, 87, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 232, 192, 0.08);
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(101, 66, 39, 0.38), rgba(54, 36, 23, 0.45));
  border: 1px solid rgba(255, 227, 173, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 231, 190, 0.06);
}

.nav-mail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mail-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.site-nav a:hover {
  color: white;
  border-color: rgba(255, 214, 224, 0.22);
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 28px auto 40px;
}

.hero,
.panel,
.stat-card,
.player-card,
.trade-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero,
.panel {
  background:
    linear-gradient(180deg, rgba(44, 29, 20, 0.94), rgba(23, 17, 13, 0.92)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0));
  border-radius: 28px;
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: #e3c394;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 56px);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 0.98;
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 28px;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

h3 {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.lead,
.empty,
.panel span,
.trade-meta,
.meta-list,
label {
  color: var(--muted);
}

.hero-actions,
.filter-bar,
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
}

.button.primary,
button.button.primary,
button[type="submit"] {
  background:
    linear-gradient(180deg, #bc8a57, #8f5c32),
    linear-gradient(90deg, rgba(255,255,255,0.08), rgba(0,0,0,0.05));
  color: white;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 231, 188, 0.24), 0 10px 20px rgba(0, 0, 0, 0.18);
}

.button.ghost {
  background: linear-gradient(180deg, rgba(88, 60, 38, 0.6), rgba(46, 32, 22, 0.72));
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 218, 166, 0.08);
}

.inline-button {
  display: inline-flex;
}

.stats-grid,
.grid-two,
.player-grid,
.home-layout {
  display: grid;
  gap: 16px;
}

.home-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.guild-layout {
  align-items: stretch;
}

.home-main {
  display: grid;
  gap: 22px;
}

.player-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.guild-sidebar {
  background:
    linear-gradient(180deg, rgba(57, 37, 24, 0.97), rgba(34, 23, 16, 0.94)),
    repeating-linear-gradient(
      180deg,
      rgba(131, 88, 48, 0.08) 0 34px,
      rgba(76, 50, 29, 0.12) 34px 38px
    );
  position: relative;
}

.guild-sidebar::after,
.guild-panel::after,
.ledger-panel::after,
.market-board::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(214, 178, 126, 0.08);
  border-radius: 20px;
  pointer-events: none;
}

.name-list {
  display: grid;
  gap: 10px;
}

.recipient-list {
  margin-top: 18px;
}

.name-link {
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(61, 41, 27, 0.82), rgba(42, 28, 18, 0.92));
  border: 1px solid rgba(211, 173, 117, 0.14);
}

.name-link strong,
.name-link span {
  display: block;
}

.name-link strong {
  margin-bottom: 4px;
  color: #fff3f6;
}

.name-link:hover {
  border-color: rgba(255, 214, 224, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.guild-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(227, 195, 148, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(67, 43, 26, 0.96), rgba(29, 20, 14, 0.94)),
    repeating-linear-gradient(
      90deg,
      rgba(122, 82, 49, 0.08) 0 82px,
      rgba(70, 45, 27, 0.12) 82px 88px
    );
}

.guild-hero::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(222, 186, 130, 0.12);
  border-radius: 22px;
  pointer-events: none;
}

.hero-copy,
.guild-stats {
  position: relative;
  z-index: 1;
}

.map-callout {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 22px;
}

.map-callout h3,
.map-callout p,
.map-callout a {
  color: var(--ink);
}

.map-callout a {
  color: #6a381d;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 700;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
  background:
    linear-gradient(180deg, rgba(67, 45, 28, 0.96), rgba(43, 30, 20, 0.98)),
    linear-gradient(90deg, rgba(255,255,255,0.03), rgba(0,0,0,0));
  border-radius: 22px;
  padding: 18px;
}

.guild-panel {
  background:
    linear-gradient(180deg, rgba(48, 31, 21, 0.94), rgba(26, 18, 13, 0.92)),
    repeating-linear-gradient(
      90deg,
      rgba(122, 81, 46, 0.05) 0 56px,
      rgba(68, 45, 26, 0.09) 56px 61px
    );
  position: relative;
}

.ledger-layout {
  align-items: start;
}

.ledger-panel {
  background:
    linear-gradient(180deg, rgba(54, 37, 24, 0.96), rgba(28, 20, 14, 0.94)),
    repeating-linear-gradient(
      180deg,
      rgba(129, 88, 52, 0.05) 0 26px,
      rgba(80, 54, 34, 0.08) 26px 30px
    );
  position: relative;
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 34px;
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
}

.player-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.player-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.player-card,
.trade-card {
  display: block;
  background: linear-gradient(180deg, rgba(53, 36, 24, 0.82), rgba(36, 24, 17, 0.92));
  border-radius: 22px;
  padding: 16px;
}

.player-card strong,
.player-card span {
  display: block;
}

.player-card img,
.base-shot {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
}

.portrait-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 14px;
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/static/images/ram2.png") center / contain no-repeat;
  pointer-events: none;
  z-index: 2;
}

.portrait-frame img {
  position: absolute;
  inset: 27% 21% 18% 21%;
  width: 58%;
  height: 55%;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  margin: 0;
  box-shadow: 0 18px 26px rgba(0, 0, 0, 0.28);
  z-index: 1;
}

.card-frame {
  max-width: 240px;
  margin-inline: auto;
}

.profile-frame {
  max-width: 320px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 22px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-portrait {
  width: 100%;
}

.base-shot {
  aspect-ratio: auto;
  max-height: 720px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.28);
}

.meta-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.sigil-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.profile-sigils {
  margin-top: 0;
}

.sigil {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(186, 151, 101, 0.24);
  background: linear-gradient(180deg, rgba(83, 54, 31, 0.88), rgba(49, 33, 21, 0.94));
  color: #f3dfbd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sigil::before {
  content: "✦";
  color: #d8b07a;
  font-size: 11px;
}

.sigil-asa {
  background: linear-gradient(180deg, rgba(95, 56, 29, 0.92), rgba(61, 35, 18, 0.96));
}

.sigil-evolved {
  background: linear-gradient(180deg, rgba(49, 72, 57, 0.9), rgba(28, 45, 34, 0.96));
}

.sigil-both {
  background: linear-gradient(180deg, rgba(74, 57, 91, 0.9), rgba(45, 33, 59, 0.96));
}

.map-sigil {
  background: linear-gradient(180deg, rgba(126, 92, 49, 0.9), rgba(72, 49, 26, 0.96));
}

.map-sigil::before {
  content: "⌘";
}

.tribe-sigil {
  background: linear-gradient(180deg, rgba(118, 68, 40, 0.9), rgba(66, 36, 20, 0.96));
}

.tribe-sigil::before {
  content: "⚔";
}

.status-sigil::before {
  content: "•";
}

.status-active {
  background: linear-gradient(180deg, rgba(72, 100, 63, 0.92), rgba(38, 56, 30, 0.96));
}

.status-completed {
  background: linear-gradient(180deg, rgba(90, 74, 54, 0.92), rgba(50, 40, 28, 0.96));
}

.story-block {
  margin-top: 22px;
}

.parchment-shell {
  position: relative;
}

.market-board {
  background:
    linear-gradient(180deg, rgba(70, 47, 29, 0.96), rgba(44, 29, 18, 0.96)),
    repeating-linear-gradient(
      90deg,
      rgba(121, 81, 46, 0.08) 0 42px,
      rgba(67, 43, 25, 0.12) 42px 46px
    );
  position: relative;
}

.notice-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.notice-card {
  position: relative;
  min-height: 100%;
  padding: 26px 18px 18px;
  border-radius: 10px;
  transform: rotate(-1deg);
  background:
    radial-gradient(circle at top left, rgba(255, 248, 232, 0.42), transparent 24%),
    linear-gradient(180deg, rgba(235, 220, 188, 0.98), rgba(202, 177, 132, 0.98));
  border: 1px solid rgba(109, 72, 34, 0.38);
  box-shadow:
    0 18px 24px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 246, 222, 0.24);
}

.notice-card:nth-child(even) {
  transform: rotate(1.1deg);
}

.notice-card:nth-child(3n) {
  transform: rotate(-0.35deg);
}

.notice-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(124, 88, 54, 0.24);
  pointer-events: none;
}

.notice-card h3,
.notice-card p,
.notice-card .trade-meta,
.notice-card a {
  color: var(--ink);
}

.notice-card .trade-meta {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}

.notice-card .button.ghost {
  background: linear-gradient(180deg, rgba(113, 74, 42, 0.16), rgba(78, 51, 29, 0.22));
  color: var(--ink);
  border-color: rgba(101, 68, 36, 0.25);
}

.notice-pin {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, #ffe6bc 0 18%, #c48345 19% 52%, #6a381d 53% 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.parchment-sheet,
.parchment-card {
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(255, 244, 219, 0.4), transparent 28%),
    linear-gradient(180deg, rgba(232, 213, 177, 0.98), rgba(202, 172, 128, 0.98));
  color: var(--ink);
  border: 1px solid rgba(121, 83, 44, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 214, 0.28),
    0 18px 34px rgba(0, 0, 0, 0.2);
}

.parchment-sheet::before,
.parchment-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(111, 73, 37, 0.18);
  border-radius: 18px;
  pointer-events: none;
}

.chronicle-sheet {
  padding: 24px;
  border-radius: 24px;
}

.chronicle-sheet h2,
.chronicle-sheet p,
.chronicle-sheet .empty {
  color: var(--ink);
}

.chronicle-sheet h2 {
  margin-bottom: 12px;
}

.chronicle-sheet p {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 18px;
  line-height: 1.8;
}

.mail-item.parchment-card {
  border-radius: 24px;
}

.mail-item.parchment-card h3,
.mail-item.parchment-card p,
.mail-item.parchment-card .trade-meta {
  color: var(--ink);
}

.mail-item.parchment-card .trade-meta {
  letter-spacing: 0.03em;
}

.letter-form {
  border-radius: 26px;
}

.letter-form h1,
.letter-form .lead,
.letter-form label {
  color: var(--ink);
}

.letter-form input,
.letter-form textarea {
  background: rgba(92, 63, 34, 0.08);
  border: 1px solid rgba(105, 69, 31, 0.28);
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.ledger-card {
  background:
    linear-gradient(180deg, rgba(230, 213, 183, 0.98), rgba(199, 172, 128, 0.98)),
    repeating-linear-gradient(
      180deg,
      rgba(120, 79, 45, 0.06) 0 30px,
      rgba(80, 53, 31, 0.09) 30px 32px
    );
  color: var(--ink);
  border: 1px solid rgba(120, 80, 40, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 218, 0.26),
    0 18px 34px rgba(0, 0, 0, 0.22);
}

.ledger-card h1,
.ledger-card .lead,
.ledger-card label,
.ledger-card .eyebrow {
  color: var(--ink);
}

.ledger-card input,
.ledger-card select {
  background: rgba(92, 63, 34, 0.08);
  border: 1px solid rgba(105, 69, 31, 0.28);
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.trade-list {
  display: grid;
  gap: 14px;
}

.mail-notice {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.mail-item {
  display: grid;
  gap: 10px;
}

.mail-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.button.is-active {
  border-color: rgba(255, 214, 224, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.form-shell {
  display: grid;
  place-items: center;
}

.form-card {
  width: min(100%, 580px);
}

.form-card.wide {
  width: min(100%, 880px);
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 214, 224, 0.12);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(10, 6, 8, 0.55);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 180px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: #f2c7d1;
}

.image-placeholder.portrait {
  aspect-ratio: 4 / 5;
  min-height: 260px;
  margin-bottom: 0;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
}

.flash-success {
  background: rgba(110, 195, 155, 0.12);
  border: 1px solid rgba(110, 195, 155, 0.28);
}

.flash-error {
  background: rgba(208, 90, 90, 0.13);
  border: 1px solid rgba(208, 90, 90, 0.28);
}

@media (max-width: 900px) {
  .hero,
  .grid-two,
  .profile-layout,
  .profile-hero,
  .home-layout {
    grid-template-columns: 1fr;
  }

  .player-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 14px 16px;
  }

  .page {
    width: min(100% - 16px, 1180px);
    margin: 16px auto 28px;
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 22px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
