:root {
  color-scheme: light dark;
  --paper: #fffaf0;
  --surface: #f2ecdf;
  --ink: #202725;
  --muted: #626b68;
  --line: rgba(32, 39, 37, 0.36);
  --soft-line: rgba(32, 39, 37, 0.17);
  --red: #a94738;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --ui: "Avenir Next Condensed", "DIN Condensed", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  place-items: start center;
  background:
    linear-gradient(90deg, rgba(32, 39, 37, 0.03) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(32, 39, 37, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  color: var(--ink);
  font-family: var(--body);
}

.conflict-app {
  width: min(700px, 100vw);
  height: min(600px, 100svh);
  padding: 4px 6px;
  display: grid;
  grid-template-rows: 47px 25px minmax(0, 1fr);
  gap: 4px;
  overflow: hidden;
}

.tool-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 3px 5px 5px;
  border-bottom: 1px solid var(--line);
}

.tool-kicker,
.tool-signature,
.case-bar,
.case-picker span,
.case-type {
  font-family: var(--ui);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-kicker {
  margin: 0 0 1px;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
}

h1 {
  font-size: 1.65rem;
  line-height: 1;
}

.tool-signature {
  color: var(--muted);
  text-decoration: none;
}

.case-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 5px;
  border-bottom: 1px solid var(--soft-line);
  color: var(--muted);
}

.case-bar a {
  margin-left: auto;
  color: inherit;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.map-card {
  min-width: 0;
  margin: 0;
}

#world-map {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.map-frame {
  fill: color-mix(in srgb, var(--paper) 94%, var(--ink) 6%);
}

.country {
  fill: color-mix(in srgb, var(--paper) 82%, var(--ink) 18%);
  stroke: color-mix(in srgb, var(--ink) 32%, transparent);
  stroke-width: 0.33;
  vector-effect: non-scaling-stroke;
}

.case-point {
  cursor: pointer;
}

.point-leader {
  stroke: color-mix(in srgb, var(--red) 62%, transparent);
  stroke-width: 0.8;
  stroke-dasharray: 2 2;
  vector-effect: non-scaling-stroke;
}

.point-halo {
  fill: color-mix(in srgb, var(--red) 24%, transparent);
  stroke: none;
}

.point-dot {
  fill: var(--red);
  stroke: var(--paper);
  stroke-width: 1.2;
}

.case-point.is-active .point-halo {
  fill: color-mix(in srgb, var(--red) 42%, transparent);
  stroke: var(--red);
  stroke-width: 1.2;
}

.case-point:focus-visible {
  outline: none;
}

.case-point:focus-visible .point-halo {
  stroke: var(--ink);
  stroke-width: 2;
}

figcaption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.case-panel {
  min-width: 0;
  padding: 0 2px;
}

.case-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

select {
  min-width: 0;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 0.8rem var(--body);
}

.case-heading {
  margin-top: 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

#case-region {
  margin: 0 0 1px;
  color: var(--muted);
  font: 700 0.67rem var(--ui);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h2 {
  font-size: 1.52rem;
  line-height: 1;
}

.case-type {
  margin: 3px 0 0;
  color: var(--red);
}

dl {
  margin: 5px 0;
}

dl div {
  padding: 4px 0;
  border-bottom: 1px solid var(--soft-line);
}

dt {
  color: var(--muted);
  font: 800 0.62rem var(--ui);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

dd {
  margin: 1px 0 0;
  font-size: 0.75rem;
  line-height: 1.25;
}

.case-summary {
  margin: 6px 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.source-line {
  margin: 6px 0 0;
  font-size: 0.7rem;
}

.source-line a {
  color: inherit;
  font-weight: 700;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .conflict-app {
    padding-inline: 3px;
    grid-template-rows: 44px 25px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 5px;
  }

  .case-bar span {
    display: none;
  }

  h2 {
    font-size: 1.2rem;
  }

  dd,
  .case-summary {
    font-size: 0.67rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Plugga-nära gränssnitt */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #f5f5f5;
  --ink: #171717;
  --muted: #666666;
  --line: #d8d8d8;
  --soft-line: #e8e8e8;
  --red: #a94738;
  --display: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: var(--display);
  --ui: var(--display);
}

body {
  background: #ffffff;
}

.conflict-app {
  padding: 16px;
  grid-template-rows: 42px 27px minmax(0, 1fr);
  gap: 8px;
}

.tool-header {
  align-items: center;
  padding: 0 0 9px;
  border-color: var(--line);
}

h1 {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.case-bar {
  padding: 2px 0 5px;
  border-color: var(--soft-line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.workspace {
  gap: 12px;
}

#world-map {
  border-color: var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.map-frame {
  fill: #ffffff;
}

.country {
  fill: #eeeeee;
  stroke: #bdbdbd;
}

.case-picker span,
.case-type,
dt,
#case-region {
  font-family: var(--body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

select {
  min-height: 32px;
  border-color: var(--line);
  border-radius: 6px;
  background: #ffffff;
  font: 13px var(--body);
}

.case-heading {
  margin-top: 9px;
  padding-bottom: 7px;
  border-color: var(--line);
}

h2 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

dd,
.case-summary {
  font-size: 12px;
  line-height: 1.35;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171717;
  --surface: #242424;
  --ink: #f2f2f2;
  --muted: #b5b5b5;
  --line: #4a4a4a;
  --soft-line: #343434;
  --red: #df7d6d;
}

html[data-theme="dark"] body,
html[data-theme="dark"] select {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] #world-map,
html[data-theme="dark"] .map-frame {
  background: #1f1f1f;
  fill: #1f1f1f;
}

html[data-theme="dark"] .country {
  fill: #292929;
  stroke: #5a5a5a;
}

@media (max-width: 520px) {
  .conflict-app {
    padding: 12px;
    grid-template-rows: 42px 27px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    overflow-y: auto;
    padding-right: 3px;
  }

  .case-panel {
    order: -1;
  }

  .map-card,
  #world-map {
    width: 100%;
  }

  .case-picker {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  h2 {
    font-size: 22px;
  }

  dd,
  .case-summary {
    font-size: 12px;
  }
}
