:root {
  --bg: #f5f2ea;
  --panel: #fffdf8;
  --ink: #1d1b16;
  --muted: #706b61;
  --line: #ded8cc;
  --soft: #f1eadc;
  --orange: #f24e1e;
  --yellow: #ffbf2f;
  --danger: #b53a22;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: 100vh;
  background: var(--bg);
}

.map-pane {
  position: relative;
  min-height: 100vh;
}

.map {
  width: 100%;
  height: 100vh;
}

.map-hud {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: calc(100% - 28px);
  padding: 8px 11px;
  border: 1px solid rgba(29, 27, 22, 0.12);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 8px 26px rgba(29, 27, 22, 0.14);
  color: var(--muted);
  font-size: 12px;
}

.map-hud strong {
  color: var(--orange);
  font-weight: 800;
}

.panel {
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
}

.header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.kicker {
  margin: 0 0 3px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 3px;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 2px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.header p,
.summary,
.empty-state p,
.photo-intel p,
.muted {
  color: var(--muted);
  line-height: 1.35;
}

.header p:last-child {
  margin-bottom: 0;
  font-size: 12px;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 9px;
}

.secret-box {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.secret-box input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 9px;
}

.check-line {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 34px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.error,
.empty-state,
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.error {
  margin: 8px 0;
  padding: 9px 10px;
  border-color: rgba(181, 58, 34, 0.32);
  color: var(--danger);
  font-size: 12px;
}

.empty-state {
  padding: 14px;
}

.empty-state h2 {
  font-size: 16px;
}

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

.card {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
}

.hidden { display: none !important; }

.card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-header code {
  max-width: 112px;
  overflow: hidden;
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--orange);
  font-size: 10px;
  text-overflow: ellipsis;
}

.summary {
  margin: 8px 0;
  font-size: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0 0 10px;
}

.stat-grid div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf8f0;
}

.stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.stat-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

h3 {
  margin: 10px 0 7px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.claim-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.card > .claim-list {
  flex: 1;
}

.claim {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf8f0;
}

.claim-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.claim strong {
  color: var(--ink);
  font-size: 12px;
}

.claim span,
.claim small {
  color: var(--muted);
  font-size: 11px;
}

.claim p {
  margin: 6px 0 0;
  color: #4d493f;
  font-size: 12px;
  line-height: 1.3;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  max-height: 172px;
  overflow: auto;
  padding-right: 2px;
}

.photo-button {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  text-align: left;
}

.photo-button:hover {
  border-color: rgba(242, 78, 30, 0.45);
  background: #fff8ec;
}

.photo-button img {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.photo-button span {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(29, 27, 22, 0.72);
  padding: 20px;
}

.photo-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  width: min(1120px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 12px;
}

.photo-modal > img {
  width: 100%;
  max-height: 84vh;
  border-radius: 12px;
  object-fit: contain;
  background: #17150f;
}

.close-button {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  padding: 8px 11px;
}

.photo-intel { padding: 6px; }

.observation {
  max-height: 220px;
  overflow: auto;
  border-radius: 10px;
  background: #f6f0e5;
  color: var(--ink);
  font-size: 11px;
  padding: 10px;
  white-space: pre-wrap;
}

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }

  .map-pane,
  .map {
    min-height: 56vh;
    height: 56vh;
  }

  .panel {
    max-height: none;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .card {
    overflow: visible;
  }

  .photo-modal {
    grid-template-columns: 1fr;
  }
}
