:root {
  --ink: #142526;
  --muted: #667472;
  --paper: #f3f0e8;
  --panel: #fffdf8;
  --line: #ded9cc;
  --forest: #183f38;
  --forest-2: #255b4e;
  --moss: #719267;
  --gold: #d2a84c;
  --gold-soft: #f4e7c3;
  --sky: #dfece8;
  --danger: #9b4a3a;
  --shadow: 0 18px 50px rgba(29, 48, 45, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 4%, rgba(210, 168, 76, 0.12), transparent 22rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: white;
  background:
    linear-gradient(rgba(10, 42, 36, 0.96), rgba(13, 49, 42, 0.98)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.025) 12px 13px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 7px 34px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px 12px 12px 3px;
  color: var(--gold);
  background: rgba(255,255,255,.06);
  font-family: Georgia, serif;
  font-size: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, serif;
  font-size: 18px;
}

.brand small {
  margin-top: 3px;
  color: rgba(255,255,255,.6);
  font-size: 11px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  color: rgba(255,255,255,.7);
  background: transparent;
  text-align: left;
  transition: .18s ease;
}

.nav-item span {
  width: 20px;
  color: var(--gold);
  font-size: 18px;
  text-align: center;
}

.nav-item:hover,
.nav-item.active {
  color: white;
  background: rgba(255,255,255,.09);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.world-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.world-status strong,
.world-status small {
  display: block;
}

.world-status strong {
  font-size: 12px;
}

.world-status small {
  margin-top: 2px;
  color: rgba(255,255,255,.55);
  font-size: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8fbd78;
  box-shadow: 0 0 0 4px rgba(143, 189, 120, .15);
}

.text-button {
  display: block;
  width: 100%;
  padding: 6px 0;
  border: 0;
  color: rgba(255,255,255,.58);
  background: none;
  font-size: 11px;
  text-align: left;
}

.text-button:hover {
  color: white;
}

.import-label input {
  display: none;
}

main {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 42px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 118px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 4px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
}

.eyebrow {
  margin: 0;
  color: var(--moss);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.save-state {
  color: var(--muted);
  font-size: 11px;
}

.primary-button,
.secondary-button {
  padding: 12px 17px;
  border-radius: 10px;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease;
}

.primary-button {
  border: 1px solid var(--forest);
  color: white;
  background: var(--forest);
}

.primary-button:hover {
  background: var(--forest-2);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--forest);
  background: rgba(255,255,255,.6);
}

.secondary-button:hover {
  border-color: #bfb8a8;
  background: white;
}

.compact {
  padding: 10px 14px;
  font-size: 12px;
}

.full {
  width: 100%;
}

.view {
  display: none;
  padding-top: 30px;
}

.view.active {
  display: block;
  animation: fade-in .22s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
}

.hero-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  padding: 34px;
  border-radius: 22px;
  color: white;
  background:
    radial-gradient(circle at 83% 30%, rgba(210,168,76,.25), transparent 17rem),
    linear-gradient(120deg, #173d36, #245648);
  box-shadow: var(--shadow);
}

.hero-card h2 {
  max-width: 620px;
  margin: 12px 0 8px;
  font-family: Georgia, serif;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.08;
}

.hero-card p {
  max-width: 650px;
  margin: 0;
  color: rgba(255,255,255,.72);
  line-height: 1.6;
}

.hero-card .secondary-button {
  flex: 0 0 auto;
  border-color: rgba(255,255,255,.25);
  color: white;
  background: rgba(255,255,255,.09);
}

.pill {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
}

.pill.accent {
  color: #ffedbd;
  background: rgba(210,168,76,.2);
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0;
}

.player-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(42, 51, 48, .045);
}

.player-card::after {
  position: absolute;
  right: -30px;
  bottom: -50px;
  width: 150px;
  height: 150px;
  border: 24px solid rgba(113,146,103,.07);
  border-radius: 50%;
  content: "";
}

.player-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: var(--forest);
  background: var(--sky);
  font-family: Georgia, serif;
  font-size: 21px;
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-identity h3 {
  margin: 0 0 3px;
  font-family: Georgia, serif;
  font-size: 22px;
}

.player-identity span {
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  position: relative;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--forest);
  background: transparent;
}

.class-path {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 20px 0 16px;
}

.class-chip {
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--forest);
  background: #e8eee9;
  font-size: 10px;
  font-weight: 750;
}

.class-chip.primary {
  color: #775915;
  background: var(--gold-soft);
}

.class-arrow {
  color: #a4aaa5;
  font-size: 10px;
}

.player-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 9px 14px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.player-meta span {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-heading,
.section-intro.split,
.advisor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel h3,
.compact-form h3 {
  margin: 5px 0 0;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 500;
}

.duration-chip,
.count-label {
  color: var(--muted);
  font-size: 11px;
}

.duo-roles {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  align-items: center;
  gap: 12px;
  margin: 30px 0;
}

.duo-roles span,
.duo-roles strong {
  display: block;
}

.duo-roles span {
  margin-bottom: 5px;
  color: var(--moss);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.duo-roles strong {
  font-size: 12px;
}

.role-link {
  height: 1px;
  background: linear-gradient(90deg, var(--gold), var(--moss));
}

.section-intro {
  margin-bottom: 24px;
}

.section-intro h2,
.advisor-heading h2 {
  margin: 6px 0 7px;
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 500;
}

.section-intro p:not(.eyebrow),
.advisor-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(280px, .42fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.planner-form,
.compact-form,
.dialog-form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: #4d5c59;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d5d0c4;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fffefa;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(113,146,103,.12);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-row.single-field {
  grid-template-columns: 1fr;
}

.coin-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.coin-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #d5d0c4;
  border-radius: 9px;
  background: #fffefa;
}

.coin-input:focus-within {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(113,146,103,.12);
}

.coin-input input {
  min-width: 0;
  border: 0;
  box-shadow: none;
}

.coin-input input:focus {
  box-shadow: none;
}

.coin-input b {
  padding-right: 10px;
  font-size: 9px;
  letter-spacing: .02em;
  text-transform: lowercase;
}

.coin-input.platinum b { color: #77898d; }
.coin-input.gold b { color: #a67b19; }
.coin-input.silver b { color: #8a8f94; }

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.plan-results {
  min-height: 470px;
}

.empty-state {
  display: grid;
  min-height: 470px;
  place-items: center;
  align-content: center;
  border: 1px dashed #c8c1b3;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  color: var(--gold);
  font-size: 42px;
}

.empty-state h3 {
  margin: 15px 0 6px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 22px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.route-summary {
  padding: 22px;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(120deg, var(--forest), var(--forest-2));
}

.route-summary h3 {
  margin: 7px 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.route-summary p {
  margin: 0;
  color: rgba(255,255,255,.7);
  font-size: 12px;
}

.route-list {
  display: grid;
  gap: 12px;
  margin-top: 13px;
}

.route-card,
.camp-card {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.route-card.primary-route {
  border-color: #bca66e;
  box-shadow: 0 8px 30px rgba(83, 70, 35, .08);
}

.route-card-top,
.camp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.route-card h4,
.camp-card h3 {
  margin: 4px 0;
  font-family: Georgia, serif;
  font-size: 19px;
}

.route-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--gold-soft);
  font-size: 11px;
  font-weight: 800;
}

.route-meta,
.camp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.mini-chip {
  padding: 5px 7px;
  border-radius: 6px;
  color: #586562;
  background: #edf0eb;
  font-size: 9px;
  font-weight: 750;
}

.route-card p,
.camp-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.route-detail {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 7px;
  font-size: 10px;
}

.route-detail span {
  color: var(--muted);
}

.confidence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.confidence::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  content: "";
}

.confidence.confirmed {
  color: #2e6b4e;
  background: #e1f0e6;
}

.confidence.confirmed::before { background: #4b976d; }
.confidence.reported {
  color: #7a5a16;
  background: var(--gold-soft);
}
.confidence.reported::before { background: var(--gold); }
.confidence.classic {
  color: #6b6674;
  background: #ece9ef;
}
.confidence.classic::before { background: #8c8299; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.camp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.camp-card {
  display: flex;
  min-height: 270px;
  flex-direction: column;
}

.camp-level {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.camp-facts {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.camp-facts div {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
}

.camp-facts span {
  color: var(--muted);
}

.market-layout,
.journal-layout {
  display: grid;
  grid-template-columns: minmax(260px, .38fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.table-panel {
  overflow: hidden;
}

table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 11px;
}

th,
td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.delete-button {
  border: 0;
  color: var(--danger);
  background: none;
  font-size: 10px;
}

.timeline {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 11px;
  padding: 12px 0;
}

.timeline-item:not(:last-child)::before {
  position: absolute;
  top: 25px;
  bottom: -4px;
  left: 5px;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 3px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.timeline-content strong,
.timeline-content small {
  display: block;
}

.timeline-content strong {
  margin-bottom: 4px;
  font-size: 11px;
}

.timeline-content p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.timeline-content small {
  color: #9a9e99;
  font-size: 9px;
}

.compact-timeline .timeline-item {
  padding: 8px 0;
}

.advisor-view {
  max-width: 980px;
  margin: 0 auto;
}

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 14px;
}

.suggestion-row button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--forest);
  background: var(--panel);
  font-size: 10px;
}

.chat-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-log {
  display: grid;
  min-height: 470px;
  max-height: calc(100vh - 330px);
  gap: 18px;
  overflow-y: auto;
  align-content: start;
  padding: 26px;
}

.message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  max-width: 82%;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 30px;
  justify-self: end;
}

.message-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--forest);
  font-family: Georgia, serif;
  font-size: 12px;
}

.message.user .message-avatar {
  grid-column: 2;
  background: var(--gold);
}

.message-bubble {
  padding: 12px 14px;
  border-radius: 4px 13px 13px 13px;
  color: #35423f;
  background: #edf1ed;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message.user .message-bubble {
  grid-row: 1;
  border-radius: 13px 4px 13px 13px;
  color: white;
  background: var(--forest-2);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid var(--line);
  background: #faf8f2;
}

.chat-composer textarea {
  min-height: 44px;
  resize: none;
}

dialog {
  width: min(600px, calc(100vw - 30px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 30px 100px rgba(10, 31, 26, .3);
}

dialog::backdrop {
  background: rgba(13, 32, 28, .6);
  backdrop-filter: blur(3px);
}

.dialog-form {
  padding: 26px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dialog-heading h2 {
  margin: 5px 0 0;
  font-family: Georgia, serif;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  padding: 12px 15px;
  border-radius: 10px;
  color: white;
  background: var(--forest);
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1050px) {
  .camp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 0 26px 50px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    display: block;
    height: auto;
    padding: 14px;
  }
  .brand { margin: 0 0 12px; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-item { justify-content: center; padding: 9px; font-size: 10px; }
  .nav-item span { display: none; }
  .sidebar-footer { display: none; }
  main { padding: 0 16px 42px; }
  .topbar { min-height: 94px; }
  .save-state { display: none; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  .player-grid,
  .dashboard-grid,
  .planner-layout,
  .market-layout,
  .journal-layout { grid-template-columns: 1fr; }
  .planner-form { order: 0; }
  .plan-results { order: 1; }
}

@media (max-width: 560px) {
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-actions .primary-button { display: none; }
  .player-grid,
  .camp-grid,
  .toolbar,
  .field-row,
  .coin-row { grid-template-columns: 1fr; }
  .hero-card { padding: 24px; }
  .advisor-heading,
  .section-intro.split { flex-direction: column; }
  .duo-roles { grid-template-columns: 1fr; }
  .role-link { display: none; }
  .message { max-width: 96%; }
}
