:root {
  color-scheme: light;
  --ink: #22291a;
  --muted: #65705b;
  --ikac: #596944;
  --ikac-dark: #344326;
  --line: rgba(52, 67, 38, .18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(145deg, #fafbf7 0%, #eef1e8 100%);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.ikac-watermark {
  position: fixed;
  inset: 50% auto auto 50%;
  width: min(66vw, 720px);
  opacity: .055;
  transform: translate(-50%, -48%);
  pointer-events: none;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1160px;
  margin: auto;
  padding: 24px 30px;
}

.host-mark, .session-actions { display: flex; align-items: center; gap: 12px; }
.host-mark { color: var(--ink); font-weight: 700; letter-spacing: .04em; text-decoration: none; }
.host-mark img { width: 44px; height: 44px; object-fit: contain; }
.session-logo { width: 54px; height: 42px; object-fit: contain; }

.button {
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  color: white;
  background: var(--ikac-dark);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(52, 67, 38, .16);
}
.button-quiet { color: var(--ikac-dark); background: rgba(255,255,255,.72); border: 1px solid var(--line); box-shadow: none; }

.mandate-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 96px);
  padding: 20px 24px 70px;
}

.registry-card {
  width: min(820px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 28px 80px rgba(47, 57, 36, .14);
  backdrop-filter: blur(18px);
}

.intro { padding: 44px 48px 24px; }
.eyebrow { margin: 0 0 8px; color: var(--ikac); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.4rem, 7vw, 4.6rem); font-weight: 500; line-height: .98; }
.lede { max-width: 520px; margin: 18px 0 0; color: var(--muted); line-height: 1.6; }

.tabs { display: flex; gap: 4px; padding: 0 48px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; padding: 17px 10px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; font-weight: 750; }
.tab[aria-selected="true"] { border-color: var(--ikac); color: var(--ikac-dark); }

.block-panel { padding: 36px 48px 44px; }
.block-heading { display: flex; align-items: center; gap: 24px; padding-bottom: 28px; }
.block-heading img { width: 90px; height: 70px; object-fit: contain; }
.block-heading h2 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.block-heading p:last-child { margin: 0; color: var(--muted); }
.block-heading h2 .zone-badge { vertical-align: .25em; }

.mandates-heading { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.mandates-heading h3 { margin: 0; font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; }
.mandates-heading span { color: var(--muted); font-size: .85rem; }
.mandate-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.mandate-list li { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.64); }
.mandate-list .empty-state { justify-content: center; color: var(--muted); font-style: italic; }
.character-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.zone-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(89, 105, 68, .2);
  border-radius: 999px;
  color: var(--ikac-dark);
  background: rgba(238, 242, 232, .9);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .03em;
  line-height: 1;
  white-space: nowrap;
}
.remove-mandate { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #8a302c; background: #f8eae8; font-size: 1.25rem; line-height: 1; }

.add-form { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.add-form label, .login-dialog label { display: block; margin-bottom: 9px; font-size: .82rem; font-weight: 750; }
.add-form > div { display: flex; gap: 10px; }
select, input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--ink); background: rgba(255,255,255,.86); }
.button-tooltip { position: relative; display: inline-flex; }
.button-tooltip .button { height: 100%; }
.button-tooltip[data-tooltip]::after {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(280px, 75vw);
  padding: 9px 12px;
  border-radius: 9px;
  color: white;
  background: var(--ikac-dark);
  box-shadow: 0 8px 24px rgba(27, 34, 20, .22);
  content: attr(data-tooltip);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.button-tooltip[data-tooltip]:hover::after,
.button-tooltip[data-tooltip]:focus::after,
.button-tooltip[data-tooltip]:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notice { margin: 0 48px 18px; padding: 12px 15px; border-radius: 12px; color: #354323; background: #edf2e8; }
.notice.error, .form-error { color: #842f2a; background: #faecea; }

.login-dialog { width: min(410px, calc(100% - 30px)); border: 1px solid rgba(255,255,255,.9); border-radius: 24px; padding: 36px; color: var(--ink); background: rgba(250,251,247,.96); box-shadow: 0 28px 90px rgba(30,38,22,.3); }
.login-dialog::backdrop { background: rgba(27,34,20,.42); backdrop-filter: blur(6px); }
.login-dialog > img { display: block; width: 80px; height: 70px; margin: 0 auto 20px; object-fit: contain; }
.login-dialog h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.login-dialog > p:not(.eyebrow) { color: var(--muted); }
.login-dialog form[data-login-form] { margin-top: 24px; }
.login-dialog form[data-login-form] .button { width: 100%; margin-top: 14px; }
.dialog-close-form { position: absolute; top: 12px; right: 14px; }
.dialog-close-form button { border: 0; color: var(--muted); background: transparent; font-size: 1.5rem; }
.form-error { padding: 9px 11px; border-radius: 9px; font-size: .85rem; }

@media (max-width: 620px) {
  .site-header { padding: 16px; }
  .host-mark span { display: none; }
  .mandate-shell { padding: 8px 12px 30px; }
  .registry-card { border-radius: 20px; }
  .intro, .block-panel { padding-left: 22px; padding-right: 22px; }
  .intro { padding-top: 30px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tab { min-width: 100px; font-size: .82rem; }
  .block-heading { gap: 14px; }
  .block-heading img { width: 70px; }
  .block-heading h2 { font-size: 1.45rem; }
  .notice { margin-left: 22px; margin-right: 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .registry-card { animation: arrive .55s ease-out both; }
  @keyframes arrive { from { opacity: 0; transform: translateY(14px); } }
}
