:root {
  --ink: #19382e;
  --ink-deep: #10251f;
  --paper: #fff2ce;
  --paper-warm: #f0d89f;
  --leaf: #4f7655;
  --moss: #85a460;
  --accent: #f47a61;
  --sun: #f6bd54;
  --sky: #a8d8c6;
  --white: #fffaf0;
  --line: 3px;
  --shadow: 8px 10px 0 rgba(16, 37, 31, 0.17);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(25, 56, 46, 0.045) 0 1.2px, transparent 1.8px) 0 0 / 17px 17px,
    var(--paper);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  text-rendering: geometricPrecision;
}

button,
input { font: inherit; }

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

button { color: inherit; }

.topography {
  position: absolute;
  z-index: 0;
  top: 70px;
  right: -90px;
  width: 520px;
  height: 520px;
  border: 2px solid rgba(25, 56, 46, 0.09);
  border-radius: 43% 57% 52% 48%;
  transform: rotate(18deg);
  pointer-events: none;
}

.topography::before,
.topography::after {
  content: "";
  position: absolute;
  border: inherit;
  border-radius: inherit;
}

.topography::before { inset: 42px 54px 61px 35px; transform: rotate(-9deg); }
.topography::after { inset: 93px 109px 118px 87px; transform: rotate(17deg); }

.auth-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  align-items: center;
  gap: clamp(55px, 9vw, 150px);
  width: min(1280px, calc(100% - 70px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 70px 0;
}

.auth-story { position: relative; padding-left: 8px; }
.auth-story .overline { color: var(--accent); }
.auth-story h1 {
  margin: 19px 0 28px;
  font-family: "Cooper Black", "Arial Rounded MT Bold", Georgia, serif;
  font-size: clamp(62px, 7vw, 106px);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.86;
}
.auth-story h1 em { color: var(--accent); font-style: normal; }
.auth-story > p { width: min(590px, 100%); margin: 0; font-family: Georgia, serif; font-size: 20px; font-style: italic; line-height: 1.55; }

.auth-features { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.auth-features span { display: flex; align-items: center; gap: 8px; padding: 9px 13px; background: rgba(255, 250, 240, 0.66); border: 2px solid var(--ink); border-radius: 22px; font-size: 10px; font-weight: 900; letter-spacing: 0.05em; box-shadow: 3px 4px 0 rgba(16, 37, 31, 0.09); }
.auth-features i { color: var(--accent); font-family: Georgia, serif; font-style: italic; }

.auth-footprint { position: absolute; top: -145px; right: 35px; width: 104px; height: 128px; transform: rotate(17deg); opacity: 0.14; }
.auth-footprint span { position: absolute; left: 27px; bottom: 0; width: 67px; height: 76px; background: var(--ink); border-radius: 50% 50% 46% 54%; }
.auth-footprint i { position: absolute; width: 25px; height: 39px; background: var(--ink); border-radius: 50%; }
.auth-footprint i:nth-child(1) { top: 28px; left: 0; transform: rotate(-25deg); }
.auth-footprint i:nth-child(2) { top: 0; left: 39px; }
.auth-footprint i:nth-child(3) { top: 24px; right: 0; transform: rotate(25deg); }

.auth-card {
  position: relative;
  min-height: 565px;
  padding: 29px 32px 34px;
  background:
    radial-gradient(circle at 85% 15%, rgba(25, 56, 46, 0.04) 0 1.2px, transparent 1.8px) 0 0 / 15px 15px,
    var(--white);
  border: 4px solid var(--ink);
  border-radius: 15px 42px 21px 30px;
  box-shadow: 14px 17px 0 rgba(16, 37, 31, 0.16), 0 30px 70px rgba(16, 37, 31, 0.13);
  transform: rotate(0.4deg);
}
.auth-card::before { content: ""; position: absolute; top: -17px; left: 70px; width: 110px; height: 30px; background: rgba(246, 189, 84, 0.86); border: 2px solid rgba(25, 56, 46, 0.35); transform: rotate(-4deg); }
.auth-tabs { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 6px; padding: 5px; background: var(--paper-warm); border: 2px solid var(--ink); border-radius: 30px; }
.auth-tabs button { min-height: 39px; background: transparent; border: 0; border-radius: 22px; font-size: 10px; font-weight: 900; letter-spacing: 0.11em; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { color: var(--paper); background: var(--ink); }
.auth-form { padding-top: 36px; }
.auth-form h2 { margin: 8px 0 28px; font-family: "Cooper Black", "Arial Rounded MT Bold", Georgia, serif; font-size: 36px; letter-spacing: -0.05em; }
.auth-form label { display: block; margin-bottom: 19px; }
.auth-form label > span { display: block; margin-bottom: 8px; font-size: 10px; font-weight: 900; letter-spacing: 0.15em; }
.auth-form input { width: 100%; height: 51px; padding: 0 14px; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 8px 15px 9px 7px; outline: none; font-weight: 900; box-shadow: inset 0 -4px 0 rgba(25, 56, 46, 0.05); }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(244, 122, 97, 0.16); }
.auth-form > small { display: block; margin: -6px 0 19px; color: rgba(25, 56, 46, 0.64); font-family: Georgia, serif; font-size: 11px; font-style: italic; line-height: 1.4; }
.auth-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 53px; margin-top: 27px; padding: 0 17px 0 20px; color: var(--paper); background: var(--accent); border: 3px solid var(--ink); border-radius: 10px 22px 12px 17px; box-shadow: 5px 6px 0 rgba(16, 37, 31, 0.15); font-size: 11px; font-weight: 900; letter-spacing: 0.12em; cursor: pointer; }
.auth-submit:hover { transform: translateY(-2px); box-shadow: 7px 9px 0 rgba(16, 37, 31, 0.14); }
.auth-submit:disabled { cursor: wait; filter: saturate(0.5); }
.auth-submit span { font-size: 22px; }
.auth-error { min-height: 21px; margin: 19px 4px 0; color: #a0443e; font-family: Georgia, serif; font-size: 12px; font-style: italic; line-height: 1.4; }

.site-header,
main { position: relative; z-index: 1; }

.site-header {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  align-items: center;
  gap: 25px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 55px 45px 48px;
}

.brand-mark {
  position: relative;
  width: 82px;
  height: 96px;
  transform: rotate(-5deg);
}

.brand-mark i {
  position: absolute;
  left: 19px;
  bottom: 0;
  width: 52px;
  height: 57px;
  background: var(--accent);
  border: 4px solid var(--ink);
  border-radius: 49% 51% 44% 56% / 59% 60% 40% 41%;
  box-shadow: 5px 6px 0 rgba(16, 37, 31, 0.14);
}

.brand-mark span {
  position: absolute;
  z-index: 2;
  width: 16px;
  height: 25px;
  background: var(--moss);
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.brand-mark span:nth-child(1) { top: 0; left: 31px; }
.brand-mark span:nth-child(2) { top: 22px; left: 2px; transform: rotate(-29deg); }
.brand-mark span:nth-child(3) { top: 19px; right: 0; transform: rotate(29deg); }

.overline,
.step-label {
  color: #a0443e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 7px 0 0;
  font-family: "Cooper Black", "Arial Rounded MT Bold", Georgia, serif;
  font-size: clamp(38px, 4.8vw, 68px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.86;
}

.brand-copy h1 em { color: var(--accent); font-style: normal; }

.connection-pill {
  display: grid;
  grid-template-columns: 13px auto;
  grid-template-rows: auto auto;
  column-gap: 11px;
  min-width: 178px;
  padding: 12px 20px 12px 16px;
  background: var(--white);
  border: var(--line) solid var(--ink);
  border-radius: 40px;
  box-shadow: 5px 6px 0 rgba(16, 37, 31, 0.13);
}

.connection-pill i {
  grid-row: 1 / 3;
  align-self: center;
  width: 11px;
  height: 11px;
  background: #66a85f;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(102, 168, 95, 0.17);
  animation: blink 2.1s ease-in-out infinite;
}

.connection-pill.is-offline i {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(244, 122, 97, 0.17);
}

.connection-pill span { font-size: 9px; font-weight: 900; letter-spacing: 0.13em; }
.connection-pill strong { margin-top: 2px; font-size: 15px; }

.header-account { display: flex; align-items: center; gap: 11px; }
.account-chip { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 5px 6px 5px 15px; background: var(--paper-warm); border: 3px solid var(--ink); border-radius: 30px; box-shadow: 4px 5px 0 rgba(16, 37, 31, 0.11); }
.account-chip > span { max-width: 130px; overflow: hidden; font-size: 10px; font-weight: 900; letter-spacing: 0.08em; text-overflow: ellipsis; white-space: nowrap; }
.account-chip button { min-height: 30px; padding: 0 11px; color: var(--paper); background: var(--ink); border: 0; border-radius: 20px; font-size: 8px; font-weight: 900; letter-spacing: 0.09em; cursor: pointer; }
.account-chip button:hover { background: var(--accent); }

main { max-width: 1500px; margin: 0 auto; padding: 0 45px 85px; }

.preview-section,
.controls-section,
.setup-strip {
  border-top: var(--line) solid var(--ink);
}

.preview-section { padding-top: 35px; }

.section-heading {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 440px);
  align-items: end;
  gap: 40px;
  margin-bottom: 27px;
}

.section-heading h2,
.panel-heading h2 {
  margin: 7px 0 0;
  font-family: "Cooper Black", "Arial Rounded MT Bold", Georgia, serif;
  font-size: 34px;
  letter-spacing: -0.045em;
  line-height: 1;
}

.section-heading p {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 16px;
  font-style: italic;
  line-height: 1.45;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 0.9fr);
  gap: 25px;
  align-items: stretch;
}

.monitor {
  display: grid;
  grid-template-rows: 47px minmax(0, 1fr) 54px;
  min-width: 0;
  overflow: hidden;
  background: var(--ink-deep);
  border: 4px solid var(--ink);
  border-radius: 22px 9px 24px 11px;
  box-shadow: var(--shadow);
}

.monitor > header,
.monitor > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--paper);
}

.monitor > header { padding: 0 17px; border-bottom: 3px solid var(--ink); }
.monitor > header span { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 900; letter-spacing: 0.16em; }
.monitor > header i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.monitor > header strong { color: rgba(255, 242, 206, 0.55); font-size: 10px; letter-spacing: 0.13em; }
.monitor-screen { position: relative; overflow: hidden; background: #0c1713; }
.monitor--landscape .monitor-screen { aspect-ratio: 16 / 9; }
.monitor--portrait .monitor-screen { min-height: 0; }
.monitor-screen iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: top left; }

.monitor > footer {
  gap: 18px;
  padding: 0 16px;
  border-top: 3px solid var(--ink);
}

.monitor > footer button,
.monitor > footer a {
  padding: 0;
  color: var(--paper);
  background: none;
  border: 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-decoration: none;
  cursor: pointer;
}

.monitor > footer button { color: var(--sun); }
.monitor > footer button:hover,
.monitor > footer a:hover { color: var(--accent); }

.controls-section {
  display: grid;
  grid-template-columns: 1.1fr 0.95fr 0.95fr;
  gap: 25px;
  margin-top: 58px;
  padding-top: 35px;
}

.control-panel {
  position: relative;
  min-width: 0;
  padding: 28px;
  background:
    radial-gradient(circle at 80% 20%, rgba(25, 56, 46, 0.035) 0 1.2px, transparent 1.8px) 0 0 / 15px 15px,
    rgba(255, 250, 240, 0.7);
  border: var(--line) solid var(--ink);
  border-radius: 9px 28px 14px 18px;
  box-shadow: var(--shadow);
}

.control-panel--identity { transform: rotate(0.35deg); }
.control-panel--alerts { transform: rotate(-0.25deg); }
.panel-heading { margin-bottom: 27px; }

.scene-buttons { display: grid; gap: 9px; }

.scene-buttons button {
  display: grid;
  grid-template-columns: 39px 1fr;
  grid-template-rows: auto auto;
  column-gap: 11px;
  padding: 12px 15px;
  color: var(--ink);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.scene-buttons button:hover { border-color: rgba(25, 56, 46, 0.28); transform: translateX(3px); }
.scene-buttons button.is-active { background: var(--paper-warm); border-color: var(--ink); box-shadow: 4px 5px 0 rgba(16, 37, 31, 0.12); }
.scene-buttons button > span { grid-row: 1 / 3; align-self: center; color: var(--accent); font-family: Georgia, serif; font-size: 16px; font-style: italic; }
.scene-buttons button strong { font-size: 15px; }
.scene-buttons button small { margin-top: 2px; color: rgba(25, 56, 46, 0.62); font-family: Georgia, serif; font-size: 12px; font-style: italic; }

.control-panel label { display: block; margin-bottom: 20px; }
.control-panel label > span,
.control-panel legend { display: block; margin-bottom: 8px; font-size: 10px; font-weight: 900; letter-spacing: 0.15em; }
.control-panel input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px 14px 9px 7px;
  outline: none;
  font-weight: 900;
  letter-spacing: 0.035em;
  box-shadow: inset 0 -4px 0 rgba(25, 56, 46, 0.05);
}

.control-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(244, 122, 97, 0.16); }
.control-panel fieldset { margin: 22px 0 0; padding: 0; border: 0; }

.theme-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: 38px;
  background: transparent;
  border: 2px solid rgba(25, 56, 46, 0.25);
  border-radius: 20px;
  cursor: pointer;
}

.theme-swatch i { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 50%; }
.theme-swatch span { font-size: 9px; font-weight: 900; letter-spacing: 0.08em; }
.theme-swatch--fern i { background: #85a460; }
.theme-swatch--amber i { background: #a19255; }
.theme-swatch--berry i { background: #d9657c; }
.theme-swatch.is-active { background: var(--white); border-color: var(--ink); box-shadow: 3px 4px 0 rgba(16, 37, 31, 0.1); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--paper-warm); border: 2px solid var(--ink); border-radius: 28px; }
.segmented button { height: 32px; background: transparent; border: 0; border-radius: 20px; font-size: 9px; font-weight: 900; letter-spacing: 0.13em; cursor: pointer; }
.segmented button.is-active { color: var(--paper); background: var(--ink); }

.alert-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.alert-buttons button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 63px;
  padding: 9px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px 18px 12px 15px;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(16, 37, 31, 0.11);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.alert-buttons button:hover { transform: translateY(-2px) rotate(-0.5deg); box-shadow: 5px 7px 0 rgba(16, 37, 31, 0.12); }
.alert-buttons button:active { transform: translateY(2px); box-shadow: 1px 1px 0 rgba(16, 37, 31, 0.1); }
.alert-buttons button > i { display: grid; place-items: center; flex: 0 0 30px; height: 30px; color: var(--paper); background: var(--accent); border: 2px solid var(--ink); border-radius: 50%; font-style: normal; font-weight: 900; }
.alert-buttons button span { min-width: 0; text-align: left; }
.alert-buttons button strong,
.alert-buttons button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-buttons button strong { font-size: 11px; }
.alert-buttons button small { margin-top: 3px; color: rgba(25, 56, 46, 0.6); font-family: Georgia, serif; font-size: 10px; font-style: italic; }
.alert-note { margin: 16px 0 0; color: rgba(25, 56, 46, 0.66); font-family: Georgia, serif; font-size: 12px; font-style: italic; line-height: 1.4; }

.setup-strip {
  display: grid;
  grid-template-columns: 160px repeat(3, 1fr) 150px;
  gap: 24px;
  align-items: start;
  margin-top: 58px;
  padding-top: 32px;
}

.setup-strip div strong { display: block; margin-bottom: 7px; font-size: 13px; }
.setup-strip div p { margin: 0; color: rgba(25, 56, 46, 0.72); font-family: Georgia, serif; font-size: 12px; line-height: 1.5; }
.setup-strip a { justify-self: end; color: var(--ink); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-decoration: none; }
.setup-strip a:hover { color: var(--accent); }
.setup-actions { display: grid; gap: 10px; justify-items: end; }
.setup-actions button { padding: 0; color: var(--accent); background: none; border: 0; font-size: 9px; font-weight: 900; letter-spacing: 0.1em; cursor: pointer; }
.setup-actions button.is-armed { padding: 7px 9px; color: var(--paper); background: var(--accent); border-radius: 5px; }

.toast {
  position: fixed;
  z-index: 20;
  right: 28px;
  bottom: 28px;
  padding: 14px 19px;
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--paper);
  border-radius: 30px;
  box-shadow: 0 0 0 3px var(--ink), 7px 9px 0 rgba(16, 37, 31, 0.2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }

@keyframes blink {
  0%, 100% { opacity: 0.6; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 1050px) {
  .auth-shell { grid-template-columns: 1fr; gap: 55px; width: min(720px, calc(100% - 50px)); }
  .auth-story { padding-top: 60px; }
  .auth-card { width: min(520px, 100%); justify-self: center; }
  .site-header { grid-template-columns: 86px 1fr; }
  .header-account { grid-column: 1 / -1; justify-self: start; }
  .preview-grid { grid-template-columns: 1fr; }
  .monitor--portrait { width: min(100%, 560px); justify-self: center; }
  .monitor--portrait .monitor-screen { aspect-ratio: 9 / 16; }
  .controls-section { grid-template-columns: 1fr 1fr; }
  .control-panel--scenes { grid-column: 1 / -1; }
  .scene-buttons { grid-template-columns: repeat(5, 1fr); }
  .scene-buttons button { display: flex; flex-direction: column; gap: 3px; }
  .scene-buttons button > span { margin-bottom: 5px; }
  .setup-strip { grid-template-columns: 1fr 1fr; }
  .setup-strip > .step-label { grid-column: 1 / -1; }
  .setup-strip a { justify-self: start; }
  .setup-actions { justify-items: start; }
}

@media (max-width: 720px) {
  .auth-shell { width: min(100% - 34px, 560px); padding: 38px 0 60px; }
  .auth-story { padding-top: 70px; }
  .auth-story h1 { font-size: clamp(51px, 15vw, 76px); }
  .auth-story > p { font-size: 16px; }
  .auth-footprint { right: 5px; transform: scale(0.8) rotate(17deg); }
  .auth-card { min-height: 530px; padding: 25px 21px 29px; border-width: 3px; }
  .auth-form h2 { font-size: 31px; }
  .site-header { grid-template-columns: 67px 1fr; padding: 35px 22px 33px; }
  .brand-mark { width: 62px; transform: scale(0.8) rotate(-5deg); transform-origin: left center; }
  .header-account { flex-wrap: wrap; }
  main { padding: 0 22px 65px; }
  .section-heading { grid-template-columns: 1fr; gap: 18px; }
  .controls-section { grid-template-columns: 1fr; }
  .control-panel--scenes { grid-column: auto; }
  .scene-buttons { grid-template-columns: 1fr; }
  .scene-buttons button { display: grid; }
  .preview-grid { gap: 18px; }
  .monitor { border-width: 3px; }
  .controls-section { margin-top: 46px; }
  .setup-strip { grid-template-columns: 1fr; }
  .setup-strip > .step-label { grid-column: auto; }
}

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