:root {
  --black: #111;
  --dark: #2a2a2a;
  --ink: #202020;
  --mid: #666;
  --muted: #888;
  --line: #d2d2d2;
  --light: #f5f5f5;
  --white: #fff;
  --blue: #e7eef8;
  --blue-ink: #233a57;
  --green: #e9f2e4;
  --green-ink: #304b29;
  --red: #fae9e8;
  --red-ink: #8a2d2a;
  --amber: #f8eddb;
  --amber-ink: #6e4c16;
  font-family: Arial, Helvetica, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-size: 14px;
  line-height: 1.45;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
.select-field select {
  padding: 10px 11px;
  width: 100%;
}
.app-header {
  border-bottom: 2px solid var(--black);
  padding: 26px 34px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.header-copy {
  min-width: 0;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--mid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: clamp(29px, 4vw, 44px);
  letter-spacing: -0.04em;
  line-height: 1;
}
h2 {
  margin-bottom: 5px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.header-subtitle {
  margin: 6px 0 0;
  color: var(--mid);
}
.project-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  color: var(--mid);
  font-size: 12px;
  flex-wrap: wrap;
}
.project-line strong {
  color: var(--black);
}
#saveStatus {
  color: var(--green-ink);
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.tool-button {
  min-height: 36px;
  border: 1px solid var(--black);
  background: var(--white);
  color: var(--black);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}
.tool-button:hover {
  background: var(--black);
  color: var(--white);
}
.tool-button:last-child {
  width: 36px;
  padding: 0;
  font-size: 16px;
}
.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 34px 60px;
}
.notice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #d8b6b4;
  background: var(--red);
  color: var(--red-ink);
}
.notice-panel h2 {
  color: var(--red-ink);
}
.notice-panel p:not(.eyebrow) {
  margin: 0;
  font-size: 13px;
}
.button {
  min-height: 36px;
  border: 1px solid var(--black);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.button-primary {
  background: var(--black);
  color: var(--white);
}
.button-primary:hover {
  background: var(--dark);
}
.button-secondary {
  background: var(--white);
  color: var(--black);
}
.button-secondary:hover {
  background: var(--light);
}
.setup-section,
.map-section,
.notes-section,
.end-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--white);
}
.setup-section,
.map-section,
.notes-section {
  padding: 22px 24px 26px;
}
.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.section-index {
  min-width: 28px;
  color: var(--mid);
  font-size: 12px;
  font-weight: 700;
}
.section-heading p {
  margin-bottom: 0;
  color: var(--mid);
  font-size: 13px;
}
.form-grid {
  display: grid;
  grid-template-columns: 5fr 1fr;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field-wide {
  grid-column: 1/-1;
}
.field span,
.field legend {
  font-size: 12px;
  font-weight: 700;
}
.field input,
.field textarea,
.notes-area {
  width: 100%;
  border: 1px solid #aaa;
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}
.field textarea {
  margin: 0;
}
.field fieldset {
  border: 0;
  padding: 0;
}
.field legend {
  margin-bottom: 7px;
}
.choice {
  display: inline-flex;
  align-items: center;
  margin: 0 16px 0 0;
  font-size: 14px;
  font-weight: 400;
}
.choice input {
  margin-right: 6px;
  accent-color: #111;
}
input:focus,
textarea:focus,
select:focus,
button:focus-visible,
.map-scroll:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
.interaction-table textarea:focus,
.interaction-table input:focus {
  outline-offset: -2px;
}
.interaction-table tbody td {
  height: 1px;
}

.interaction-table tbody td textarea {
  display: block;
  height: 100%;
  min-height: 102px;
}
.map-tabs {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-bottom: 1px solid var(--black);
  white-space: nowrap;
}
.map-tabs::-webkit-scrollbar {
  display: none;
}
.map-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--light);
  color: var(--mid);
  padding: 10px 34px 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-tab:hover {
  background: var(--line);
  color: var(--black);
}
.map-tab.is-active {
  margin-bottom: -1px;
  border-color: var(--black);
  background: var(--white);
  color: var(--black);
}
.map-tab-close {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: 16px;
  line-height: 1;
  padding: 2px 3px;
}
.map-tab-close:hover,
.signifier-row button:hover {
  background: var(--red);
  color: var(--red-ink);
}
.map-tab-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0 14px;
  flex-wrap: wrap;
}
.map-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
}
.interaction-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}
.interaction-table th,
.interaction-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  vertical-align: top;
}
.interaction-table th:last-child,
.interaction-table td:last-child {
  border-right: 0;
}
.interaction-table th {
  height: 38px;
  padding: 8px;
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--light);
}
.interaction-table th small {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0;
}
.location-column {
  width: 19%;
  background: var(--white);
}
input.location {
  border-bottom: 1px solid var(--line) !important;
  padding: 11px !important;
}
.principle-column {
  width: 20%;
  background: var(--green);
  color: var(--green-ink);
}
.change-column {
  width: 23%;
  background: var(--amber);
  color: var(--amber-ink);
}
.remove-column {
  width: 75px;
}
.interaction-table td input,
.interaction-table td select,
.interaction-table td textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 12px 10px;
}
.interaction-table td textarea {
  min-height: 102px;
  resize: vertical;
}
.interaction-table td input,
.interaction-table td select {
  padding-bottom: 5px;
}
select.principle {
  border: 1px solid var(--ink) !important;
  margin: 3px;
  width: calc(100% - 6px) !important;
  padding: 10px 11px !important;
}
.principle-help {
  display: block;
  padding: 0 10px 8px;
  color: var(--mid);
  font-size: 11px;
  line-height: 1.25;
}
.signifier-box {
  margin: 0 10px 10px;
  padding: 9px;
  background: var(--blue);
  border: 1px solid #c6d5e8;
}
.signifier-box label {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-ink);
  font-size: 11px;
  font-weight: 700;
}
.signifier-row {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
}
.signifier-row input {
  min-width: 0 !important;
  border: 1px solid #9cafc7 !important;
  background: var(--white) !important;
  padding: 7px !important;
}
.signifier-row button {
  border: 0;
  background: transparent;
  font-size: 17px;
}
.mini-add {
  border: 1px solid #7488a2;
  background: var(--white);
  padding: 4px 6px;
  font-size: 11px;
}
.mini-add:hover {
  border-color: var(--black);
  background: var(--light);
}
.row-delete {
  margin: 5px 8px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
}
.row-delete:hover {
  color: var(--red-ink);
}
.add-row-button {
  width: 100%;
  margin-top: 10px;
  border: 1px dashed #aaa;
  background: var(--white);
  color: var(--black);
  padding: 11px;
  font-weight: 700;
  font-size: 12px;
}
.add-row-button:hover {
  border-color: var(--black);
  background: var(--light);
}
.notes-area {
  min-height: 130px;
}
.end-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  background: var(--light);
}
.end-panel p {
  margin: 0;
  color: var(--mid);
  font-size: 12px;
}
dialog {
  border: 1px solid var(--black);
  padding: 0;
  background: var(--white);
  color: var(--black);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.tool-dialog {
  width: min(560px, calc(100% - 32px));
}
.help-dialog {
  width: min(620px, calc(100% - 32px));
}
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  background: var(--black);
  color: var(--white);
}
.dialog-header .eyebrow {
  color: #ccc;
}
.dialog-header h2 {
  margin: 0;
  color: var(--white);
}
.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--white);
  background: transparent;
  color: var(--white);
  font-size: 22px;
  line-height: 1;
}
.icon-button:hover {
  background: var(--white);
  color: var(--black);
}
.dialog-content {
  padding: 22px;
}
.dialog-intro {
  color: var(--mid);
  font-size: 13px;
}
.example-link {
  color: var(--black);
  text-decoration: none;
}
.tool-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 12px;
  text-align: left;
}
.tool-card:hover {
  border-color: var(--black);
  background: var(--light);
}
.tool-card span {
  color: var(--mid);
  font-size: 12px;
}
.dialog-warning {
  margin: 18px 0 0;
  padding: 11px;
  background: var(--amber);
  color: var(--amber-ink);
  font-size: 12px;
}
.saved-maps-list {
  border-top: 1px solid var(--line);
}
.saved-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.saved-map-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.saved-map-meta {
  margin-top: 3px;
  color: var(--mid);
  font-size: 11px;
}
.saved-map-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mini-button {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 6px 8px;
  color: var(--black);
  font-size: 11px;
}
.mini-button:hover {
  border-color: var(--black);
  background: var(--light);
}
.mini-button.delete:hover {
  border-color: var(--red-ink);
  color: var(--red-ink);
  background: var(--red);
}
.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.help-list {
  margin: 20px 0;
  border-top: 1px solid var(--line);
}
.help-list div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.help-list dt {
  font-weight: 700;
}
.help-list dd {
  margin: 0;
  color: var(--mid);
}
.print-only {
  display: none;
}

.map-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

.interaction-table {
  min-width: 1040px;
  border-collapse: collapse;
  border-spacing: 0;
}

.interaction-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--black);
}
.interaction-table thead {
  border-bottom: 1px solid var(--black);
}

@media (max-width: 720px) {
  .app-header,
  .app-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .tool-button:first-child {
    flex: 1;
  }

  .notice-panel,
  .end-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice-panel .button,
  .end-panel .button {
    width: 100%;
  }

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

  .field-wide {
    grid-column: auto;
  }

  .map-tab-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-tab-actions .button {
    width: 100%;
  }

  .map-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .interaction-table {
    min-width: 920px;
  }

  .saved-map {
    grid-template-columns: 1fr;
  }

  .saved-map-actions {
    justify-content: flex-start;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions .button {
    width: 100%;
  }
}
@media print {
  body {
    font-size: 11px;
  }
  .app-header,
  .app-shell {
    display: none;
  }
  .print-only {
    display: block;
    padding: 25px;
  }
  .print-map {
    break-after: page;
  }
  .print-map h2 {
    font-size: 16px;
  }
  .print-map table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
  }
  .print-map th,
  .print-map td {
    border: 1px solid #aaa;
    padding: 7px;
    text-align: left;
    vertical-align: top;
  }
  .print-context p,
  .print-context strong {
    margin: 0 !important;
    padding: 0 !important;
  }
  .print-map th {
    background: #f5f5f5;
  }
  .eyebrow {
    font-size: 9px;
  }
}
