:root {
  color-scheme: light dark;
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #eaeaef;
  --text: #1d1d1f;
  --text-secondary: #515154;
  --text-tertiary: #6e6e73;
  --line: #d2d2d7;
  --line-strong: #a8a8ad;
  --accent: #0a6cff;
  --accent-pressed: #0058d6;
  --accent-ink: #ffffff;
  --success: #167642;
  --success-soft: #e2f4e8;
  --error: #b42318;
  --error-soft: #fff0ed;
  --puck-shell: #202124;
  --puck-screen: #070b10;
  --puck-text: #f5f5f7;
  --puck-muted: #aeb7c2;
  --shadow: 0 20px 55px rgb(0 0 0 / 10%);
  --focus: 0 0 0 4px rgb(10 108 255 / 24%);
  --radius-large: 24px;
  --radius-medium: 14px;
  --content-width: 1180px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--text);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 12%, rgb(10 108 255 / 6%), transparent 28rem),
    var(--canvas);
  color: var(--text);
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

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

button,
summary {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(100% - 48px, var(--content-width));
  margin: 0 auto;
}

.site-header {
  min-height: 80px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  padding: 4px;
  display: grid;
  border-radius: 50%;
  background: var(--puck-shell);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 25%);
}

.brand-mark span {
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: inherit;
  background: var(--puck-screen);
}

.header-note {
  margin: 0 0 0 auto;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

main {
  min-height: calc(100vh - 156px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(2.75rem, 6vw, 5.75rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

h3 {
  margin-bottom: 7px;
  font-size: 0.95rem;
  line-height: 1.35;
}

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.58;
}

.overline,
.section-label {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.lead {
  max-width: 560px;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: clamp(44px, 8vw, 104px);
  align-items: center;
  padding: clamp(54px, 8vw, 94px) 0 76px;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 32px;
}

.platform-list span,
.device-badge {
  min-height: 34px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.platform-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
}

.platform-dot.youtube {
  background: #d92d20;
}

.platform-dot.bluesky {
  background: #087ac1;
}

.puck-stage {
  width: fit-content;
  margin-left: clamp(0px, 5vw, 54px);
  text-align: center;
}

.puck {
  width: 292px;
  height: 292px;
  padding: 18px;
  display: grid;
  border: 1px solid #35363a;
  border-radius: 50%;
  background: linear-gradient(145deg, #414349, var(--puck-shell) 45%, #0f1012);
  box-shadow: 0 30px 54px rgb(0 0 0 / 20%), inset 0 2px 2px rgb(255 255 255 / 25%);
  transform: rotate(-4deg);
}

.puck-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid #3c4149;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 18%, rgb(76 154 255 / 12%), transparent 46%),
    var(--puck-screen);
  color: var(--puck-text);
  box-shadow: inset 0 0 22px rgb(0 0 0 / 80%);
}

.puck-platform {
  color: var(--puck-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.puck-screen strong {
  margin: 10px 0 1px;
  color: #70aaff;
  font-size: 3.12rem;
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
}

.puck-unit,
.puck-screen small {
  color: var(--puck-muted);
  font-size: 0.68rem;
}

.puck-progress {
  width: 126px;
  height: 4px;
  margin: 22px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #303640;
}

.puck-progress span {
  width: 23%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #70aaff;
}

.puck-caption {
  margin: 18px 0 0;
  font-size: 0.8125rem;
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.login-panel {
  max-width: 480px;
  justify-self: end;
  box-shadow: var(--shadow);
}

.login-panel > p:not(.section-label) {
  margin-bottom: 28px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

input:not([type="checkbox"]),
select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input::placeholder {
  color: var(--text-tertiary);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.field-hint,
.form-note,
.privacy-note {
  margin: 8px 0 0;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.form-note {
  margin-top: 14px;
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.2;
  transition: background-color 140ms ease, color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.button:active:not(:disabled) {
  transform: scale(0.985);
}

.button-primary,
.button-secondary {
  width: 100%;
  margin-top: 16px;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover {
  background: var(--accent-pressed);
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--line-strong);
}

.button-quiet {
  background: transparent;
  color: var(--accent);
}

.button-quiet:hover {
  background: rgb(10 108 255 / 8%);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button[aria-busy="true"]::before {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  display: inline-block;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -2px;
  animation: spin 700ms linear infinite;
}

.help-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.help-block p,
.future-note p,
.devices-panel > p {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.privacy-note {
  margin-top: 20px;
}

.message {
  margin-top: 22px;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--success), transparent 58%);
  border-radius: 12px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.86rem;
  font-weight: 600;
}

.message.error {
  border-color: color-mix(in srgb, var(--error), transparent 58%);
  background: var(--error-soft);
  color: var(--error);
}

.dashboard {
  padding-bottom: 72px;
}

.page-heading {
  padding: clamp(46px, 7vw, 76px) 0 38px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.page-heading > *,
.section-heading > *,
.dashboard-grid > *,
.settings-row > *,
#channels,
details,
details form {
  min-width: 0;
}

.page-heading h1 {
  margin-bottom: 12px;
  font-size: clamp(2.7rem, 5vw, 4.5rem);
}

.page-heading p:last-child {
  margin-bottom: 0;
}

.device-badge {
  margin-bottom: 5px;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.section-heading .section-label {
  margin-bottom: 8px;
}

.section-heading h2 {
  margin-bottom: 22px;
}

.limit-note {
  padding-top: 3px;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.preview-grid {
  min-height: 138px;
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.preview-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.preview-card .platform {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.preview-card .count {
  margin: 9px 0 4px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 1;
}

.preview-card p,
.preview-card .status {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.preview-card .status {
  margin-top: 12px;
  color: var(--text-tertiary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.channel-row {
  margin: 16px 0;
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.5fr) 44px;
  gap: 10px;
  align-items: end;
}

.channel-row > div {
  min-width: 0;
}

.channel-row input,
.channel-row select {
  font-size: 1rem;
}

.remove {
  width: 44px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--error);
  font-size: 1.4rem;
}

.remove:hover {
  background: var(--error-soft);
}

.add-channel {
  margin: 1px 0 4px -10px;
}

.add-channel::before {
  margin-right: 6px;
  content: "+";
  font-size: 1.1rem;
}

.settings-row {
  margin-top: 18px;
  padding-top: 22px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
}

.check-row {
  min-height: 44px;
  margin: 0;
  display: flex;
  align-items: start;
  gap: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--accent);
}

.check-row small {
  margin-top: 3px;
  display: block;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-weight: 400;
}

.select-label {
  width: 150px;
  margin: 0;
  flex: none;
}

.select-label select {
  min-height: 44px;
  margin-top: 7px;
  padding: 8px 10px;
  font-size: 1rem;
}

.future-note {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--radius-medium);
  background: var(--surface-soft);
}

.future-note .section-label {
  margin-bottom: 7px;
}

.future-note h3 {
  margin-bottom: 5px;
}

.device-list {
  margin: 18px 0 26px;
  padding: 0;
  list-style: none;
}

.device-list li {
  min-height: 58px;
  padding: 11px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.device-dot {
  width: 32px;
  height: 32px;
  flex: none;
  border: 8px solid var(--puck-shell);
  border-radius: 50%;
  background: var(--text-tertiary);
}

.device-dot.online {
  background: var(--success);
}

.device-list strong,
.device-list small {
  display: block;
  overflow-wrap: anywhere;
}

.device-list strong {
  color: var(--text);
  font-size: 0.8rem;
}

.device-list small {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.device-code-section {
  margin: 0 0 26px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.device-code-section h3 {
  margin-bottom: 5px;
}

.device-code-section > p {
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.device-code-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

#own-code {
  min-width: 0;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow-x: auto;
}

.device-code-controls .button {
  margin: 0;
  white-space: nowrap;
}

.device-code-note {
  min-height: 1.3em;
  margin-top: 10px !important;
  margin-bottom: 0 !important;
  color: var(--text-tertiary);
}

details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

summary {
  min-height: 48px;
  padding: 14px 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
}

details form {
  padding-bottom: 22px;
}

details form > p {
  font-size: 0.8rem;
}

.confirm-row {
  margin-top: 16px;
}

.help-block.compact {
  margin-top: 25px;
  padding-top: 0;
  border-top: 0;
}

footer {
  min-height: 76px;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

footer span:first-child {
  color: var(--text-secondary);
  font-weight: 700;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .login-layout {
    gap: 36px;
  }

  .puck {
    width: 238px;
    height: 238px;
    padding: 15px;
  }

  .puck-screen strong {
    font-size: 2.55rem;
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 32px, var(--content-width));
  }

  .site-header {
    min-height: 68px;
    padding: 10px 0;
  }

  .header-note {
    display: none;
  }

  #logout {
    margin-left: auto;
  }

  .login-layout {
    grid-template-columns: 1fr;
    padding: 42px 0 54px;
  }

  .login-panel {
    max-width: none;
    justify-self: stretch;
  }

  .puck-stage {
    margin: 30px auto 0;
  }

  .page-heading {
    align-items: start;
  }

  .device-badge,
  .limit-note {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .device-code-controls {
    grid-template-columns: 1fr 1fr;
  }

  #own-code {
    grid-column: 1 / -1;
  }

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

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .panel {
    padding: 22px;
    border-radius: 20px;
  }

  .section-heading {
    display: block;
  }

  .limit-note {
    display: block;
    margin: -12px 0 20px;
  }

  .page-heading {
    flex-direction: column;
    gap: 16px;
  }

  .channel-row {
    grid-template-columns: minmax(95px, 0.7fr) minmax(0, 1.4fr) 44px;
  }

  .settings-row {
    flex-direction: column;
    gap: 12px;
  }

  .select-label {
    width: 100%;
  }

  footer {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 390px) {
  .channel-row {
    grid-template-columns: 1fr 44px;
  }

  .channel-row > div:first-child {
    grid-column: 1 / -1;
  }

  .channel-row .remove {
    grid-column: 2;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #000000;
    --surface: #1c1c1e;
    --surface-raised: #2c2c2e;
    --surface-soft: #2c2c2e;
    --text: #f5f5f7;
    --text-secondary: #aeaeb2;
    --text-tertiary: #98989d;
    --line: #3a3a3c;
    --line-strong: #636366;
    --accent: #4c9aff;
    --accent-pressed: #70aaff;
    --accent-ink: #001329;
    --success: #4cd07d;
    --success-soft: #112d1d;
    --error: #ff6961;
    --error-soft: #351512;
    --shadow: 0 22px 60px rgb(0 0 0 / 48%);
    --focus: 0 0 0 4px rgb(76 154 255 / 30%);
  }

  body {
    background:
      radial-gradient(circle at 12% 12%, rgb(76 154 255 / 10%), transparent 28rem),
      var(--canvas);
  }

  .panel,
  .preview-card,
  .platform-list span,
  .device-badge {
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 3%);
  }

  .platform-dot.youtube {
    background: #ff6961;
  }

  .platform-dot.bluesky {
    background: #64b5f6;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #76767b;
    --line-strong: #515154;
  }

  .panel,
  .preview-card,
  input:not([type="checkbox"]),
  select {
    border-width: 2px;
  }
}

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

@media print {
  body {
    background: #ffffff;
  }

  .button,
  footer {
    display: none;
  }
}
