:root {
  color-scheme: light;
  --ink: #0b1c2f;
  --ink-soft: #52667f;
  --ink-faint: #8492a4;
  --paper: #f4efe5;
  --surface: #fffdf8;
  --surface-2: #f8f4eb;
  --line: #d9d0c0;
  --line-soft: #e8e1d5;
  --teal: #18c3b6;
  --teal-deep: #087e78;
  --teal-soft: #ddf7f2;
  --amber: #f5b842;
  --coral: #ef766b;
  --shadow: 0 18px 55px rgba(32, 44, 56, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-width: 320px; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% 3%, rgba(24, 195, 182, 0.12), transparent 28rem),
    linear-gradient(180deg, #f8f4ec 0, var(--paper) 70%);
}

button,
input,
textarea,
a { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

.site-head {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid rgba(11, 28, 47, 0.13);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 18px; letter-spacing: 0.09em; }
.brand small { color: var(--ink-faint); font-size: 9px; font-weight: 850; letter-spacing: 0.18em; }

.toge-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--ink);
  box-shadow: 0 6px 20px rgba(11, 28, 47, 0.16);
}

.toge-mark i,
.toge-mark b {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--teal);
  transform: rotate(45deg);
}

.toge-mark i:first-child { top: 7px; left: 7px; }
.toge-mark i:nth-child(2) { right: 7px; bottom: 7px; }
.toge-mark b { top: 13px; left: 13px; border-color: var(--amber); background: rgba(245, 184, 66, 0.18); }

.truth-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
}

.truth-state span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.truth-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 184, 66, 0.17);
}

.truth-state small { color: var(--ink-faint); font-size: 10px; }

.discord-door {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #5865f2;
  border-radius: 12px;
  color: #fff;
  background: #5865f2;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(88, 101, 242, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.discord-door:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(88, 101, 242, 0.27); }
.discord-door:focus-visible { outline: 3px solid rgba(88, 101, 242, 0.27); outline-offset: 3px; }
.discord-door.is-head { justify-self: end; min-width: 116px; padding: 10px 14px; font-size: 12px; font-weight: 850; }
.discord-door span { display: grid; gap: 2px; }
.discord-door small { opacity: 0.72; font-size: 8px; font-weight: 850; letter-spacing: 0.15em; }
.discord-door strong { font-size: 12px; }
.discord-door b { font-size: 20px; }

main { width: min(1540px, calc(100% - clamp(24px, 5vw, 88px))); margin: 0 auto; }

.hero {
  max-width: 920px;
  display: grid;
  gap: 18px;
  padding: clamp(44px, 7vw, 92px) 0 clamp(36px, 5vw, 66px);
}

.eyebrow,
.panel-head small {
  color: var(--teal-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 em { color: var(--teal-deep); font-style: normal; }
.hero > p { max-width: 760px; margin: 0; color: var(--ink-soft); font-size: clamp(15px, 1.5vw, 19px); line-height: 1.6; }

.honesty-row { display: flex; flex-wrap: wrap; gap: 8px; }
.honesty-row span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: rgba(255,255,255,.45); font-size: 10px; font-weight: 750; }
.honesty-row i { color: var(--teal-deep); font-style: normal; }

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(460px, 1.55fr) minmax(270px, 0.82fr);
  gap: 14px;
  align-items: start;
  padding-bottom: 52px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.panel-head {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head > span { display: grid; gap: 4px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head b { padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-faint); font-size: 8px; letter-spacing: 0.08em; }
.panel-head b.is-teal { color: var(--teal-deep); border-color: rgba(24,195,182,.4); background: var(--teal-soft); }

.hop-panel,
.rooms-panel { position: sticky; top: 86px; }

.hop-drop {
  margin: 18px;
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border: 1.5px dashed #b8ad9d;
  border-radius: 14px;
  color: var(--ink-soft);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.hop-drop:hover,
.hop-drop:focus-visible,
.hop-drop.is-dragging { border-color: var(--teal); background: var(--teal-soft); outline: none; transform: translateY(-2px); }
.hop-drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--teal); border-radius: 13px; color: var(--teal-deep); background: var(--surface); font-size: 11px; font-weight: 950; }
.hop-drop strong { color: var(--ink); font-size: 13px; }
.hop-drop small { font-size: 10px; }

.hop-card { margin: 18px; padding: 15px; border: 1px solid rgba(24,195,182,.45); border-radius: 14px; background: var(--teal-soft); }
.hop-card[hidden] { display: none; }
.hop-card header { display: flex; align-items: center; gap: 10px; }
.hop-card header > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--ink); }
.hop-card header div { min-width: 0; display: grid; gap: 2px; }
.hop-card header small { color: var(--teal-deep); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.hop-card header strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hop-card p { margin: 14px 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.hop-card footer { display: flex; align-items: center; justify-content: space-between; color: var(--ink-faint); font-size: 9px; }
.hop-card button { border: 0; color: var(--teal-deep); background: transparent; font-size: 9px; font-weight: 850; }

.boundary-note { margin: 18px; padding: 14px; border-left: 3px solid var(--amber); color: var(--ink-soft); background: rgba(245,184,66,.09); }
.boundary-note strong { color: var(--ink); font-size: 10px; }
.boundary-note p { margin: 5px 0 0; font-size: 9px; line-height: 1.5; }

.room-builder { padding-bottom: 18px; }
.room-preview { position: relative; min-height: 300px; overflow: hidden; display: grid; place-items: center; border-bottom: 1px solid var(--line-soft); background: radial-gradient(circle, rgba(24,195,182,.16), transparent 49%), linear-gradient(180deg, #fffdf8, #f7f1e6); }
.room-preview::after { position: absolute; inset: auto 22px 16px; content: "LOCAL PREVIEW · AUCUNE PRÉSENCE DISTANTE"; color: var(--ink-faint); font-size: 8px; font-weight: 900; letter-spacing: .14em; text-align: center; }
.orbit { position: absolute; border: 1px solid rgba(24,195,182,.34); border-radius: 50%; }
.orbit-one { width: 225px; height: 225px; }
.orbit-two { width: 168px; height: 168px; border-style: dashed; }
.room-preview[data-state="ready"] .orbit-one { animation: orbit-pulse 4s ease-in-out infinite; }
@keyframes orbit-pulse { 50% { transform: scale(1.05); opacity: .6; } }
.room-core { z-index: 1; width: 132px; height: 132px; display: grid; place-items: center; align-content: center; gap: 3px; border: 1px solid var(--teal); border-radius: 50%; background: rgba(255,253,248,.94); box-shadow: 0 14px 38px rgba(24,195,182,.15); text-align: center; }
.room-core small { color: var(--ink-faint); font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.room-core strong { color: var(--teal-deep); font-size: 28px; letter-spacing: -.04em; }
.room-core span { max-width: 100px; overflow: hidden; color: var(--ink-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.slot { position: absolute; width: 42px; height: 42px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 13px; color: var(--ink-faint); background: rgba(255,253,248,.75); }
.slot-a { transform: translate(-162px, -70px); }
.slot-b { transform: translate(162px, -70px); }
.slot-c { transform: translate(0, 130px); }

#roomForm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.field { min-width: 0; display: grid; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field > span { color: var(--ink-soft); font-size: 9px; font-weight: 850; }
.field input,
.field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: var(--surface); padding: 11px 12px; font-size: 11px; resize: vertical; }
.field input:focus,
.field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24,195,182,.12); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.form-actions > span { display: flex; align-items: center; gap: 7px; color: var(--ink-faint); font-size: 8px; }
.form-actions i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.primary-button { min-height: 42px; padding: 0 18px; border: 1px solid var(--teal-deep); border-radius: 10px; color: #fff; background: var(--teal-deep); font-size: 10px; font-weight: 900; }
.primary-button:hover { background: #056b66; }

.room-list { max-height: 340px; overflow: auto; display: grid; gap: 8px; padding: 14px; }
.empty-state { min-height: 184px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 20px; color: var(--ink-faint); text-align: center; }
.empty-state > span { font-size: 32px; }
.empty-state strong { color: var(--ink-soft); font-size: 11px; }
.empty-state p { max-width: 190px; margin: 0; font-size: 9px; line-height: 1.5; }
.room-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line-soft); border-radius: 11px; color: var(--ink); background: var(--surface); text-align: left; }
.room-item:hover,
.room-item.is-selected { border-color: var(--teal); background: var(--teal-soft); }
.room-item > b { min-width: 34px; color: var(--teal-deep); font-size: 11px; }
.room-item > span { min-width: 0; display: grid; gap: 2px; }
.room-item strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.room-item small { color: var(--ink-faint); font-size: 8px; }
.room-item > i { color: var(--ink-faint); font-size: 12px; font-style: normal; }

.selected-contract { margin: 0 14px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.selected-contract[hidden] { display: none; }
.selected-contract > div:first-child { display: grid; gap: 3px; }
.selected-contract small { color: var(--teal-deep); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.selected-contract strong { font-size: 12px; }
.selected-contract > p { margin: 10px 0; color: var(--ink-soft); font-size: 9px; line-height: 1.5; }
.selected-contract dl { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0; }
.selected-contract dl div { padding: 8px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); }
.selected-contract dt { color: var(--ink-faint); font-size: 7px; text-transform: uppercase; }
.selected-contract dd { margin: 3px 0 0; font-size: 9px; font-weight: 800; }
.contract-actions { display: flex !important; grid-template-columns: none !important; gap: 7px !important; margin-top: 10px; }
.contract-actions button { flex: 1; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: var(--surface); font-size: 8px; font-weight: 850; }
.contract-actions button:hover { border-color: var(--teal); }
.contract-actions .danger-button:hover { color: #a53d35; border-color: var(--coral); }
.rooms-panel > .discord-door { margin: 14px; }
.discord-note { margin: -5px 18px 17px; color: var(--ink-faint); font-size: 8px; line-height: 1.45; text-align: center; }

.site-foot { min-height: 54px; display: flex; justify-content: space-between; gap: 18px; padding: 18px clamp(18px,4vw,64px); border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.site-foot code { color: var(--teal-deep); }

.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: min(380px, calc(100vw - 44px)); padding: 12px 15px; border-radius: 11px; color: #fff; background: var(--ink); box-shadow: 0 15px 45px rgba(11,28,47,.24); font-size: 10px; transform: translateY(24px); opacity: 0; pointer-events: none; transition: 180ms ease; }
.toast.is-visible { transform: none; opacity: 1; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(230px, .72fr) minmax(430px, 1.28fr); }
  .rooms-panel { position: static; grid-column: 1 / -1; display: grid; grid-template-columns: 1fr minmax(260px, .65fr); }
  .rooms-panel .panel-head { grid-column: 1 / -1; }
  .rooms-panel .room-list { grid-row: 2 / 5; }
  .rooms-panel > .discord-door { align-self: end; }
  .discord-note { align-self: start; }
}

@media (max-width: 760px) {
  .site-head { position: relative; grid-template-columns: 1fr auto; padding: 10px 14px; }
  .truth-state { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line-soft); }
  .discord-door.is-head { min-width: 0; }
  main { width: calc(100% - 24px); }
  .hero { padding: 38px 3px 30px; }
  .hero h1 { font-size: clamp(38px, 13vw, 62px); }
  .workspace { display: flex; flex-direction: column; gap: 12px; }
  .panel { width: 100%; }
  .hop-panel,
  .rooms-panel { position: static; }
  .room-builder { order: 1; }
  .hop-panel { order: 0; }
  .rooms-panel { order: 2; display: block; }
  .hop-drop { min-height: 140px; }
  .room-preview { min-height: 265px; }
  #roomForm { grid-template-columns: 1fr 1fr; padding: 14px; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .site-foot { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .truth-state small { font-size: 8px; }
  .hero h1 { font-size: 40px; }
  .hero > p { font-size: 14px; }
  .panel-head { padding: 14px; }
  .panel-head b { max-width: 108px; text-align: center; }
  .slot-a { transform: translate(-125px, -66px); }
  .slot-b { transform: translate(125px, -66px); }
  #roomForm { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .site-foot span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
