:root{
  --bg: #eaf4ff;
  --ink: #233447;
  --muted: #61748a;

  --glass: rgba(255,255,255,0.72);
  --glass-strong: rgba(255,255,255,0.85);
  --border: rgba(175,205,235,0.65);

  --blue: #9bbcff;
  --blue-deep: #6e93ee;

  --honey: #ffd6a5;
  --blush: #f3c4d8;
  --mint: #aee9d1;

  --ok: #76bfa2;
  --warn: #f2b36f;
  --danger: #e48b8b;

  --shadow: 0 16px 40px rgba(12, 25, 43, 0.10);
  --inner: inset 0 1px 0 rgba(255,255,255,0.75);

  --r: 26px;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  color: var(--ink);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 45%),
    radial-gradient(circle at 80% 18%, rgba(155,188,255,0.35) 0%, rgba(155,188,255,0) 48%),
    radial-gradient(circle at 70% 80%, rgba(243,196,216,0.22) 0%, rgba(243,196,216,0) 50%),
    radial-gradient(circle at 18% 78%, rgba(174,233,209,0.18) 0%, rgba(174,233,209,0) 50%),
    var(--bg);
  overflow: hidden;
}

/* Tier mood overlay (day/night glow shift) */
.mood {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.0;
  transition: opacity 600ms ease;
}

body.tier-0 .mood { opacity: 0.00; }
body.tier-1 .mood { opacity: 0.10; }
body.tier-2 .mood { opacity: 0.18; }
body.tier-3 .mood { opacity: 0.28; }
body.tier-4 .mood { opacity: 0.38; }

.mood::before{
  content:"";
  position:absolute;
  inset:-40px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 214, 165, 0.22), transparent 55%),
    radial-gradient(circle at 20% 70%, rgba(243, 196, 216, 0.18), transparent 58%),
    radial-gradient(circle at 80% 70%, rgba(110, 147, 238, 0.18), transparent 58%),
    radial-gradient(circle at 50% 85%, rgba(12, 25, 43, 0.10), transparent 50%);
  filter: blur(10px);
}

/* Layout */
.layout{
  height: 100vh;
  padding: 22px;
  display: grid;
  grid-template-columns: 320px 1fr 400px;
  gap: 18px;
}

.col{
  display:flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.panel{
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow), var(--inner);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.panel.soft{
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
}

.panel h2{
  margin: 0 0 10px 0;
  font-size: 1.12rem;
  letter-spacing: 0.2px;
  display:flex;
  align-items:center;
  gap: 10px;
}

.kicker{
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 12px 0;
  line-height: 1.35;
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f1f7ff);
  color: var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(12, 25, 43, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(12, 25, 43, 0.09);
}

.btn:active{
  transform: translateY(0px);
  filter: brightness(0.98);
}

.btn.primary{
  border-color: rgba(155,188,255,0.9);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(155,188,255,0.16));
}

.btn.warm{
  border-color: rgba(255,214,165,0.85);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,214,165,0.20));
}

.btn.danger{
  border-color: rgba(228,139,139,0.75);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(228,139,139,0.18));
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  color: var(--muted);
}

.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.6);
}

.dot.ok{ background: var(--ok); }
.dot.warn{ background: var(--warn); }
.dot.danger{ background: var(--danger); }

.bigValue{
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.breathe{
  animation: breathe 2.6s ease-in-out infinite;
  display: inline-block;
}

@keyframes breathe{
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.035); filter: saturate(1.06); }
}

.statLine{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 18px;
  margin-bottom: 10px;
}

.statLine .label{
  color: var(--muted);
  font-weight: 600;
}

.statLine .math{
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.badge{
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
}

.badge.ok{ color: var(--ok); }
.badge.warn{ color: var(--warn); }
.badge.danger{ color: var(--danger); }

.sliderBlock{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items:center;
  padding: 10px 12px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 18px;
  margin-top: 10px;
}

input[type="range"]{
  width: 100%;
  accent-color: var(--blue-deep);
}

.small{
  font-size: 0.85rem;
  color: var(--muted);
}

/* Villager list */
.search{
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.65);
  outline: none;
  font-weight: 600;
}

.list{
  margin-top: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow:auto;
  padding-right: 4px;
}

.listItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.46);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.listItem:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.62);
}

.listItem.active{
  border-color: rgba(155,188,255,0.95);
  background: rgba(155,188,255,0.20);
}

.avatar{
  width: 40px;
  height: 40px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(175,205,235,0.6);
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
  box-shadow: 0 10px 22px rgba(12,25,43,0.06);
  font-weight: 800;
}

.avatar .emoji{
  font-size: 18px;
  margin-right: 4px;
}

.liMeta{
  display:flex;
  flex-direction: column;
  line-height: 1.15;
}

.liMeta .name{
  font-weight: 800;
}

.liMeta .sub{
  font-size: 0.85rem;
  color: var(--muted);
}

/* Code & journal */
pre{
  margin: 0;
  background: rgba(255,255,255,0.62);
  border: 1px dashed rgba(175,205,235,0.75);
  border-radius: 18px;
  padding: 12px;
  font-size: 0.86rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.journal{
  background: rgba(255,255,255,0.76);
  border-style: solid;
  border-color: rgba(175,205,235,0.65);
}

.journal::after{
  /* page curl */
  content:"";
  position:absolute;
  right: 0;
  bottom: 0;
  width: 78px;
  height: 78px;
  background: linear-gradient(135deg, rgba(255,255,255,0) 52%, rgba(255,214,165,0.32) 53%, rgba(255,214,165,0.16) 100%);
  border-left: 1px solid rgba(175,205,235,0.50);
  border-top: 1px solid rgba(175,205,235,0.50);
  border-top-left-radius: 18px;
}

/* Warnings block */
.warningLine{
  font-weight: 900;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.52);
}

.warningLine.ok{ color: var(--ok); }
.warningLine.warn{ color: var(--warn); }
.warningLine.danger{ color: var(--danger); }

/* Scrollbars */
.list::-webkit-scrollbar,
.journalScroll::-webkit-scrollbar{
  width: 10px;
}
.list::-webkit-scrollbar-thumb,
.journalScroll::-webkit-scrollbar-thumb{
  background: rgba(155,188,255,0.35);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.65);
}
.list::-webkit-scrollbar-track,
.journalScroll::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}

/* Responsive */
@media (max-width: 1100px){
  body{ overflow:auto; }
  .layout{
    height: auto;
    grid-template-columns: 1fr;
  }
}

/* ===== Percentage Bars (Dreams/Jealousy) ===== */

.barCard {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 12px;
  align-items: center;
  padding: 14px 14px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 20px;
}

.barTitle {
  font-weight: 800;
  margin-bottom: 8px;
}

.barTrack {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(175,205,235,0.6);
  background: rgba(255,255,255,0.65);
}

.barFill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(155,188,255,0.95), rgba(110,147,238,0.75));
  box-shadow: 0 6px 16px rgba(110,147,238,0.20);
  transition: width 180ms ease;
}

.barFill.warm {
  background: linear-gradient(90deg, rgba(255,214,165,0.92), rgba(243,196,216,0.78));
  box-shadow: 0 6px 16px rgba(242,179,111,0.18);
}

.barOverlayInput {
  /* invisible range slider over the bar */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.barValue {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--ink);
  text-align: right;
}

.barHint {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ===== Network form ===== */

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 800;
  color: var(--muted);
  font-size: 0.86rem;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.72);
  outline: none;
  font-weight: 700;
  color: var(--ink);
}

.input:focus {
  border-color: rgba(155,188,255,0.95);
  box-shadow: 0 0 0 4px rgba(155,188,255,0.18);
}

.formActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}

.helper {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ===== Villager Journals (combined panel) ===== */

.split2 {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  min-height: 0;
}

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

.tabRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px 0;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
}

.tab.active {
  border-color: rgba(155,188,255,0.95);
  background: rgba(155,188,255,0.18);
  color: var(--ink);
}

.journalBox {
  border: 1px dashed rgba(175,205,235,0.75);
  background: rgba(255,255,255,0.60);
  border-radius: 18px;
  padding: 12px;
}

.graphWrap {
  border: 1px dashed rgba(175,205,235,0.75);
  background: rgba(255,255,255,0.60);
  border-radius: 18px;
  padding: 12px;
}

.graphHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 800;
}

.legendItem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.55);
}

.swatch {
  width: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(110,147,238,0.85);
}

.swatch.warm { background: rgba(243,196,216,0.95); }

.miniStatRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.miniStat {
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.50);
  font-weight: 800;
  color: var(--muted);
}

.miniStat b { color: var(--ink); }

/* =========================
   Wharf Portal (search.html)
========================= */

.wharf-page {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 35%, #e9f3ff 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.wharf-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.wharf-card {
  width: min(920px, 96vw);
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(90,120,160,0.18);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(30, 70, 120, 0.15);
  overflow: hidden;
}

.wharf-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(90,120,160,0.12);
}

.wharf-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wharf-title h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: #143454;
}

.wharf-emoji { font-size: 26px; }

.wharf-subtitle {
  margin: 8px 0 0;
  color: rgba(20, 52, 84, 0.72);
  line-height: 1.35;
}

.wharf-heroRow {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 18px 22px 6px;
}

.wharf-hero {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(90,120,160,0.18);
  box-shadow: 0 10px 24px rgba(20,52,84,0.10);
}

.wharf-heroText {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.wharf-pill {
  display: inline-block;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(120, 200, 255, 0.18);
  border: 1px solid rgba(120, 200, 255, 0.28);
  color: #143454;
  font-weight: 600;
}

.wharf-note {
  color: rgba(20, 52, 84, 0.78);
  line-height: 1.35;
}

.wharf-form {
  padding: 14px 22px 22px;
}

.wharf-field {
  margin-top: 14px;
}

.wharf-field label {
  display: block;
  font-weight: 700;
  color: #143454;
  margin-bottom: 8px;
}

.wharf-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wharf-row input {
  flex: 1;
  min-width: 240px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(20,52,84,0.18);
  outline: none;
  background: rgba(255,255,255,0.9);
}

.wharf-row input:focus {
  border-color: rgba(120,200,255,0.7);
  box-shadow: 0 0 0 4px rgba(120,200,255,0.20);
}

.wharf-hint {
  margin-top: 8px;
  color: rgba(20, 52, 84, 0.62);
  font-size: 13px;
}

.wharf-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.wharf-btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(20,52,84,0.20);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  color: #143454;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wharf-btn:hover { box-shadow: 0 10px 22px rgba(20,52,84,0.10); }

.wharf-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wharf-btn.primary {
  background: rgba(120,200,255,0.22);
  border-color: rgba(120,200,255,0.35);
}

.wharf-btn.ghost {
  background: rgba(255,255,255,0.6);
}

.wharf-btn.link {
  background: transparent;
  border-color: transparent;
  color: rgba(20,52,84,0.70);
  font-weight: 700;
}

.wharf-status {
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(20,52,84,0.14);
  background: rgba(255,255,255,0.75);
}

.wharf-status pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  color: rgba(20,52,84,0.85);
}

.wharf-status.error { border-color: rgba(255, 80, 80, 0.35); }
.wharf-status.success { border-color: rgba(80, 200, 120, 0.35); }

.wharf-result {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(20,52,84,0.12);
  background: rgba(255,255,255,0.65);
}

.wharf-result pre {
  margin: 10px 0 0;
  font-size: 12px;
  white-space: pre-wrap;
}
.wharf-footer {
  margin-top: 14px;
  color: rgba(20, 52, 84, 0.62);
  font-size: 13px;
}

@media (max-width: 760px) {
  .wharf-heroRow {
    grid-template-columns: 1fr;
  }
  .wharf-hero { height: 180px; }
}
:root{
  --bg: #eaf4ff;
  --ink: #233447;
  --muted: #61748a;

  --glass: rgba(255,255,255,0.72);
  --glass-strong: rgba(255,255,255,0.85);
  --border: rgba(175,205,235,0.65);

  --blue: #9bbcff;
  --blue-deep: #6e93ee;

  --honey: #ffd6a5;
  --blush: #f3c4d8;
  --mint: #aee9d1;

  --ok: #76bfa2;
  --warn: #f2b36f;
  --danger: #e48b8b;

  --shadow: 0 16px 40px rgba(12, 25, 43, 0.10);
  --inner: inset 0 1px 0 rgba(255,255,255,0.75);

  --r: 26px;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  color: var(--ink);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 45%),
    radial-gradient(circle at 80% 18%, rgba(155,188,255,0.35) 0%, rgba(155,188,255,0) 48%),
    radial-gradient(circle at 70% 80%, rgba(243,196,216,0.22) 0%, rgba(243,196,216,0) 50%),
    radial-gradient(circle at 18% 78%, rgba(174,233,209,0.18) 0%, rgba(174,233,209,0) 50%),
    var(--bg);
  overflow: hidden;
}

/* Tier mood overlay (day/night glow shift) */
.mood {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.0;
  transition: opacity 600ms ease;
}

body.tier-0 .mood { opacity: 0.00; }
body.tier-1 .mood { opacity: 0.10; }
body.tier-2 .mood { opacity: 0.18; }
body.tier-3 .mood { opacity: 0.28; }
body.tier-4 .mood { opacity: 0.38; }

.mood::before{
  content:"";
  position:absolute;
  inset:-40px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 214, 165, 0.22), transparent 55%),
    radial-gradient(circle at 20% 70%, rgba(243, 196, 216, 0.18), transparent 58%),
    radial-gradient(circle at 80% 70%, rgba(110, 147, 238, 0.18), transparent 58%),
    radial-gradient(circle at 50% 85%, rgba(12, 25, 43, 0.10), transparent 50%);
  filter: blur(10px);
}

/* Layout */
.layout{
  height: 100vh;
  padding: 22px;
  display: grid;
  grid-template-columns: 320px 1fr 400px;
  gap: 18px;
}

.col{
  display:flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.panel{
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow), var(--inner);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.panel.soft{
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
}

.panel h2{
  margin: 0 0 10px 0;
  font-size: 1.12rem;
  letter-spacing: 0.2px;
  display:flex;
  align-items:center;
  gap: 10px;
}

.kicker{
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 12px 0;
  line-height: 1.35;
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f1f7ff);
  color: var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(12, 25, 43, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(12, 25, 43, 0.09);
}

.btn:active{
  transform: translateY(0px);
  filter: brightness(0.98);
}

.btn.primary{
  border-color: rgba(155,188,255,0.9);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(155,188,255,0.16));
}

.btn.warm{
  border-color: rgba(255,214,165,0.85);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,214,165,0.20));
}

.btn.danger{
  border-color: rgba(228,139,139,0.75);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(228,139,139,0.18));
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  color: var(--muted);
}

.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.6);
}

.dot.ok{ background: var(--ok); }
.dot.warn{ background: var(--warn); }
.dot.danger{ background: var(--danger); }

.bigValue{
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.breathe{
  animation: breathe 2.6s ease-in-out infinite;
  display: inline-block;
}

@keyframes breathe{
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.035); filter: saturate(1.06); }
}

.statLine{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 18px;
  margin-bottom: 10px;
}

.statLine .label{
  color: var(--muted);
  font-weight: 600;
}

.statLine .math{
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.badge{
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
}

.badge.ok{ color: var(--ok); }
.badge.warn{ color: var(--warn); }
.badge.danger{ color: var(--danger); }

.sliderBlock{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items:center;
  padding: 10px 12px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 18px;
  margin-top: 10px;
}

input[type="range"]{
  width: 100%;
  accent-color: var(--blue-deep);
}

.small{
  font-size: 0.85rem;
  color: var(--muted);
}

/* Villager list */
.search{
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.65);
  outline: none;
  font-weight: 600;
}

.list{
  margin-top: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow:auto;
  padding-right: 4px;
}

.listItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.46);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.listItem:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.62);
}

.listItem.active{
  border-color: rgba(155,188,255,0.95);
  background: rgba(155,188,255,0.20);
}

.avatar{
  width: 40px;
  height: 40px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(175,205,235,0.6);
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
  box-shadow: 0 10px 22px rgba(12,25,43,0.06);
  font-weight: 800;
}

.avatar .emoji{
  font-size: 18px;
  margin-right: 4px;
}

.liMeta{
  display:flex;
  flex-direction: column;
  line-height: 1.15;
}

.liMeta .name{
  font-weight: 800;
}

.liMeta .sub{
  font-size: 0.85rem;
  color: var(--muted);
}

/* Code & journal */
pre{
  margin: 0;
  background: rgba(255,255,255,0.62);
  border: 1px dashed rgba(175,205,235,0.75);
  border-radius: 18px;
  padding: 12px;
  font-size: 0.86rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.journal{
  background: rgba(255,255,255,0.76);
  border-style: solid;
  border-color: rgba(175,205,235,0.65);
}

.journal::after{
  /* page curl */
  content:"";
  position:absolute;
  right: 0;
  bottom: 0;
  width: 78px;
  height: 78px;
  background: linear-gradient(135deg, rgba(255,255,255,0) 52%, rgba(255,214,165,0.32) 53%, rgba(255,214,165,0.16) 100%);
  border-left: 1px solid rgba(175,205,235,0.50);
  border-top: 1px solid rgba(175,205,235,0.50);
  border-top-left-radius: 18px;
}

/* Warnings block */
.warningLine{
  font-weight: 900;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.52);
}

.warningLine.ok{ color: var(--ok); }
.warningLine.warn{ color: var(--warn); }
.warningLine.danger{ color: var(--danger); }

/* Scrollbars */
.list::-webkit-scrollbar,
.journalScroll::-webkit-scrollbar{
  width: 10px;
}
.list::-webkit-scrollbar-thumb,
.journalScroll::-webkit-scrollbar-thumb{
  background: rgba(155,188,255,0.35);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.65);
}
.list::-webkit-scrollbar-track,
.journalScroll::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}

/* Responsive */
@media (max-width: 1100px){
  body{ overflow:auto; }
  .layout{
    height: auto;
    grid-template-columns: 1fr;
  }
}

/* ===== Percentage Bars (Dreams/Jealousy) ===== */

.barCard {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 12px;
  align-items: center;
  padding: 14px 14px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.42);
  border-radius: 20px;
}

.barTitle {
  font-weight: 800;
  margin-bottom: 8px;
}

.barTrack {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(175,205,235,0.6);
  background: rgba(255,255,255,0.65);
}

.barFill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(155,188,255,0.95), rgba(110,147,238,0.75));
  box-shadow: 0 6px 16px rgba(110,147,238,0.20);
  transition: width 180ms ease;
}

.barFill.warm {
  background: linear-gradient(90deg, rgba(255,214,165,0.92), rgba(243,196,216,0.78));
  box-shadow: 0 6px 16px rgba(242,179,111,0.18);
}

.barOverlayInput {
  /* invisible range slider over the bar */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.barValue {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--ink);
  text-align: right;
}

.barHint {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ===== Network form ===== */

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 800;
  color: var(--muted);
  font-size: 0.86rem;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.72);
  outline: none;
  font-weight: 700;
  color: var(--ink);
}

.input:focus {
  border-color: rgba(155,188,255,0.95);
  box-shadow: 0 0 0 4px rgba(155,188,255,0.18);
}

.formActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}

.helper {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ===== Villager Journals (combined panel) ===== */

.split2 {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  min-height: 0;
}

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

.tabRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px 0;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
}

.tab.active {
  border-color: rgba(155,188,255,0.95);
  background: rgba(155,188,255,0.18);
  color: var(--ink);
}

.journalBox {
  border: 1px dashed rgba(175,205,235,0.75);
  background: rgba(255,255,255,0.60);
  border-radius: 18px;
  padding: 12px;
}

.graphWrap {
  border: 1px dashed rgba(175,205,235,0.75);
  background: rgba(255,255,255,0.60);
  border-radius: 18px;
  padding: 12px;
}

.graphHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 800;
}

.legendItem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(175,205,235,0.55);
  background: rgba(255,255,255,0.55);
}

.swatch {
  width: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(110,147,238,0.85);
}

.swatch.warm { background: rgba(243,196,216,0.95); }

.miniStatRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.miniStat {
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(175,205,235,0.45);
  background: rgba(255,255,255,0.50);
  font-weight: 800;
  color: var(--muted);
}

.miniStat b { color: var(--ink); }

/* =========================
   Wharf Portal (search.html)
========================= */

.wharf-page {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 35%, #e9f3ff 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.wharf-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.wharf-card {
  width: min(920px, 96vw);
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(90,120,160,0.18);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(30, 70, 120, 0.15);
  overflow: hidden;
}

.wharf-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(90,120,160,0.12);
}

.wharf-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wharf-title h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: #143454;
}

.wharf-emoji { font-size: 26px; }

.wharf-subtitle {
  margin: 8px 0 0;
  color: rgba(20, 52, 84, 0.72);
  line-height: 1.35;
}

.wharf-heroRow {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 18px 22px 6px;
}

.wharf-hero {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(90,120,160,0.18);
  box-shadow: 0 10px 24px rgba(20,52,84,0.10);
}

.wharf-heroText {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.wharf-pill {
  display: inline-block;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(120, 200, 255, 0.18);
  border: 1px solid rgba(120, 200, 255, 0.28);
  color: #143454;
  font-weight: 600;
}

.wharf-note {
  color: rgba(20, 52, 84, 0.78);
  line-height: 1.35;
}

.wharf-form {
  padding: 14px 22px 22px;
}

.wharf-field {
  margin-top: 14px;
}

.wharf-field label {
  display: block;
  font-weight: 700;
  color: #143454;
  margin-bottom: 8px;
}

.wharf-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wharf-row input {
  flex: 1;
  min-width: 240px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(20,52,84,0.18);
  outline: none;
  background: rgba(255,255,255,0.9);
}

.wharf-row input:focus {
  border-color: rgba(120,200,255,0.7);
  box-shadow: 0 0 0 4px rgba(120,200,255,0.20);
}

.wharf-hint {
  margin-top: 8px;
  color: rgba(20, 52, 84, 0.62);
  font-size: 13px;
}

.wharf-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.wharf-btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(20,52,84,0.20);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  color: #143454;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wharf-btn:hover { box-shadow: 0 10px 22px rgba(20,52,84,0.10); }

.wharf-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wharf-btn.primary {
  background: rgba(120,200,255,0.22);
  border-color: rgba(120,200,255,0.35);
}

.wharf-btn.ghost {
  background: rgba(255,255,255,0.6);
}

.wharf-btn.link {
  background: transparent;
  border-color: transparent;
  color: rgba(20,52,84,0.70);
  font-weight: 700;
}

.wharf-status {
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(20,52,84,0.14);
  background: rgba(255,255,255,0.75);
}

.wharf-status pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  color: rgba(20,52,84,0.85);
}

.wharf-status.error { border-color: rgba(255, 80, 80, 0.35); }
.wharf-status.success { border-color: rgba(80, 200, 120, 0.35); }

.wharf-result {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(20,52,84,0.12);
  background: rgba(255,255,255,0.65);
}

.wharf-result pre {
  margin: 10px 0 0;
  font-size: 12px;
  white-space: pre-wrap;
}

.wharf-footer {
  margin-top: 14px;
  color: rgba(20, 52, 84, 0.62);
  font-size: 13px;
}

@media (max-width: 760px) {
  .wharf-heroRow {
    grid-template-columns: 1fr;
  }
  .wharf-hero { height: 180px; }
}

/* ===============================
   Wharf Navigation Bar
================================ */


.wharf-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(90, 120, 160, 0.18);
}

/* Base nav container */
.wharf-nav__inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Alignment modifiers */
.wharf-nav__inner--left{ justify-content: flex-start; }
.wharf-nav__inner--right{ justify-content: flex-end; }
.wharf-nav__inner--between{ justify-content: space-between; } /* optional */

/* Links */
.wharf-nav__link {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  color: rgba(11, 26, 42, 0.88);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(90, 120, 160, 0.18);
}

.wharf-nav__link:hover {
  background: rgba(255, 255, 255, 0.95);
}

.wharf-nav__title {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(11, 26, 42, 0.7);
}

