:root {
  color-scheme: light;
  --bg: #ffffff;
  --page: #fbfbfa;
  --surface: #ffffff;
  --surface-hover: #f7f7f5;
  --text: #37352f;
  --muted: #787774;
  --faint: #9b9a97;
  --line: #e6e4df;
  --line-strong: #d8d5cf;
  --accent: #2f6feb;
  --accent-soft: #eaf1ff;
  --danger: #d44c47;
  --shadow: 0 12px 36px rgb(15 15 15 / 0.08);
  --radius: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Pretendard, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn3d {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes workspacePopIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes poofOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.98);
  }
}

@keyframes notePoofOut {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(12px);
  }
}

@keyframes viewPoofOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes tinyPopIn {
  0% {
    transform: translateY(6px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes tinyPopOut {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(4px);
    opacity: 0;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  overflow: hidden;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #141414;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong {
  font-size: 14px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition:
    background 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #b7b5af;
}

.status-pill[data-state="connected"] .status-dot {
  background: #0f9f6e;
}

.status-pill[data-state="connecting"] .status-dot {
  background: #b88700;
}

.status-pill[data-state="error"] .status-dot {
  background: var(--danger);
}

.app-main {
  min-height: calc(100vh - 56px);
}

.view[hidden] {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.home-view {
  min-height: calc(100vh - 56px);
  padding: clamp(40px, 7vw, 76px) 20px 72px;
  background: var(--page);
  perspective: 1200px;
}

.home-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  animation: pageIn 0.46s var(--ease);
  transform-origin: 50% 18%;
}

.home-pop-in {
  animation: popIn3d 0.48s var(--ease);
}

.home-title {
  margin-bottom: 30px;
}

.home-title h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 800;
  line-height: 1.04;
}

.home-title p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.section-heading,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  min-height: 34px;
  margin-bottom: 8px;
}

.section-heading h2,
.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.muted-label {
  color: var(--muted);
  font-size: 12px;
}

.recent-list {
  display: grid;
  gap: 2px;
}

.recent-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 6px 8px;
  background: transparent;
  animation: rowIn 0.26s var(--ease);
  color: inherit;
  text-align: left;
  transition:
    background 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.recent-row:hover {
  border-color: var(--line);
  background: var(--surface);
}

.recent-row.expired .recent-title {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.recent-row.expired .recent-icon {
  opacity: 0.58;
}

.recent-row.expired .recent-open {
  display: none;
}

.recent-icon {
  display: grid;
  width: 34px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.recent-main {
  min-width: 0;
}

.recent-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.recent-title,
.recent-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-title {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.recent-lock {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.recent-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.recent-expiry {
  position: relative;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.recent-expiry.urgent {
  background: #fff0ef;
  color: var(--danger);
}

.recent-expiry.expired {
  max-width: min(260px, 32vw);
  overflow: hidden;
  background: transparent;
  padding-inline: 0;
  color: var(--danger);
  text-overflow: ellipsis;
}

.recent-expiry::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 0.16s var(--ease),
    transform 0.16s var(--ease);
  white-space: normal;
}

.recent-expiry:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.recent-open {
  color: var(--faint);
  font-size: 12px;
}

.empty-state {
  display: none;
  min-height: 54px;
  align-items: center;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-hover);
  font-size: 14px;
}

.empty-state.show {
  display: flex;
  animation: rowIn 0.28s var(--ease);
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.action-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: 0 1px 0 rgb(15 15 15 / 0.03);
  animation: popIn3d 0.36s var(--ease) both;
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    background 0.18s var(--ease);
}

.action-card:nth-child(2) {
  animation-delay: 0.05s;
}

.action-card:hover {
  background: #fcfcfb;
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px rgb(15 15 15 / 0.06);
}

.action-card strong,
.action-card small {
  display: block;
}

.action-card strong {
  font-size: 16px;
}

.action-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.action-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-hover);
  color: var(--text);
}

.action-icon svg {
  width: 19px;
  height: 19px;
}

.action-symbol {
  font-size: 19px;
  font-weight: 750;
  line-height: 1;
}

.icons-ready .action-icon .lucide + .action-symbol {
  display: none;
}

.panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(15 15 15 / 0.03);
  transition:
    box-shadow 0.18s var(--ease);
  animation: popIn3d 0.36s var(--ease) both;
}

.home-actions .panel:nth-child(2) {
  animation-delay: 0.05s;
}

.panel:hover {
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-heading svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.tool-select select,
.tool-range input[type="range"] {
  min-width: 0;
}

.field input,
.field select,
.tool-select select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease),
    background 0.16s var(--ease);
}

.field input,
.field select {
  padding: 0 10px;
}

.field input:focus,
.field select:focus,
.tool-select select:focus {
  border-color: #b8b5ad;
  box-shadow: 0 0 0 3px rgb(15 15 15 / 0.06);
}

.field-disabled span {
  color: var(--faint);
}

.code-input {
  text-transform: uppercase;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.check-row,
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

.check-row input,
.toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--text);
}

.subtle-check {
  color: var(--faint);
  font-size: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  font-weight: 650;
  transition:
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.primary-button,
.secondary-button {
  background: var(--text);
  color: #ffffff;
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover {
  background: #2f2d29;
  box-shadow: 0 7px 18px rgb(15 15 15 / 0.08);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  box-shadow: 0 7px 18px rgb(15 15 15 / 0.08);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.icon-button:active {
  box-shadow: none;
}

.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.icon-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  gap: 0;
  padding: 0;
  line-height: 0;
}

.icon-symbol {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

i[data-lucide] {
  display: none;
}

.icons-ready button svg + .icon-symbol,
.icons-ready button .lucide + .icon-symbol {
  display: none;
}

.small {
  min-height: 34px;
}

.form-footer.end {
  justify-content: flex-end;
}

.poof-out {
  pointer-events: none;
  animation: poofOut 0.18s var(--ease) forwards;
}

.note-poof-out {
  pointer-events: none;
  animation: notePoofOut 0.18s var(--ease) forwards;
}

.view-poof-out {
  pointer-events: none;
  animation: viewPoofOut 0.18s var(--ease) forwards;
}

.tiny-pop-in {
  animation: tinyPopIn 0.18s var(--ease);
}

.tiny-pop-out {
  animation: tinyPopOut 0.16s var(--ease) forwards;
}

.workspace-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 56px);
  background: var(--bg);
  animation: pageIn 0.34s var(--ease);
  perspective: 1400px;
  transform-origin: 50% 12%;
}

.workspace-pop-in {
  animation: workspacePopIn 0.42s var(--ease);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px clamp(12px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.96);
  backdrop-filter: blur(18px);
}

.session-strip,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.presence-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.activity-status {
  overflow: hidden;
  max-width: min(260px, 30vw);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.note-title-button,
.note-title-input {
  overflow: hidden;
  max-width: 340px;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-title-button {
  display: block;
  appearance: none;
  justify-content: flex-start;
  min-height: 24px;
  margin: -2px -5px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 2px 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.note-title-button:hover,
.note-title-button:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.note-title-input {
  width: min(340px, 52vw);
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: 0 0 0 3px rgb(15 15 15 / 0.05);
}

.self-badge {
  overflow: hidden;
  max-width: 340px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-select,
.tool-range {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.tool-select span,
.tool-range span,
.toggle span {
  white-space: nowrap;
}

.tool-select select {
  width: 124px;
  min-height: 34px;
  padding: 0 8px;
}

.tool-range input {
  width: 92px;
  accent-color: var(--text);
}

.tool-range output {
  width: 24px;
  color: var(--text);
  text-align: right;
}

.workspace-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.editor-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

#editor {
  width: 100%;
  height: calc(100vh - 56px - 58px);
  min-height: 430px;
}

.remote-pointer-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
}

.remote-pointer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}

.remote-pointer-label {
  position: absolute;
  left: 9px;
  bottom: calc(100% + 9px);
  max-width: 180px;
  transform: translateX(-2px);
  border-radius: 5px;
  padding: 3px 7px;
  background: var(--participant-color);
  color: var(--participant-label-color);
  box-shadow: 0 8px 18px rgb(15 15 15 / 0.12);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0.86;
  overflow: hidden;
  pointer-events: auto;
  text-overflow: ellipsis;
  transition: opacity 0.12s var(--ease);
  white-space: nowrap;
}

.remote-pointer-icon {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 18px;
  height: 22px;
  background: var(--participant-color);
  clip-path: polygon(0 0, 0 18px, 5px 13px, 8px 22px, 12px 20px, 9px 12px, 17px 12px);
  filter: drop-shadow(0 2px 3px rgb(15 15 15 / 0.18));
  opacity: 0.9;
  pointer-events: auto;
  transition: opacity 0.12s var(--ease);
}

.remote-pointer:hover .remote-pointer-label,
.remote-pointer:hover .remote-pointer-icon {
  opacity: 0.1;
}

.remote-pointer.is-typing .remote-pointer-icon {
  width: 4px;
  height: 23px;
  transform: translateX(4px);
  border-radius: 999px;
  clip-path: none;
}

.remote-pointer.is-typing .remote-pointer-icon::before,
.remote-pointer.is-typing .remote-pointer-icon::after {
  position: absolute;
  left: -5px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: var(--participant-color);
  content: "";
}

.remote-pointer.is-typing .remote-pointer-icon::before {
  top: 0;
}

.remote-pointer.is-typing .remote-pointer-icon::after {
  bottom: 0;
}

.remote-pointer.is-selecting .remote-pointer-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--participant-color);
  border-radius: 4px;
  background: rgb(255 255 255 / 0.72);
  clip-path: none;
}

.remote-pointer.is-emphasized .remote-pointer-label,
.remote-pointer.is-emphasized .remote-pointer-icon {
  animation: pointerPulse 0.9s var(--ease);
}

@keyframes pointerPulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.floating-panel {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 15;
  width: min(320px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.presence-panel,
.settings-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.presence-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.presence-heading svg {
  width: 16px;
  height: 16px;
}

.participants-list {
  display: grid;
  align-content: start;
  gap: 2px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
}

.settings-stack {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.ttl-note {
  margin: -2px 0 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.panel-range {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 26px;
  width: 100%;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.switch-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--text);
}

.participant {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-radius: 6px;
  padding: 6px 8px;
  background: transparent;
  transition: background 0.16s var(--ease);
}

.participant:hover {
  background: var(--surface-hover);
}

.participant-color {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.participant-name {
  overflow: hidden;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.participant-name {
  cursor: pointer;
}

button.participant-name:hover,
button.participant-name:focus-visible {
  color: var(--accent);
  outline: none;
}

.pin-dialog,
.share-dialog,
.flow-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.pin-dialog {
  width: min(340px, calc(100vw - 32px));
}

.share-dialog {
  width: min(680px, calc(100vw - 32px));
}

.flow-dialog {
  width: min(430px, calc(100vw - 32px));
}

.pin-dialog::backdrop,
.share-dialog::backdrop,
.flow-dialog::backdrop {
  background: rgb(15 15 15 / 0.28);
  backdrop-filter: blur(3px);
}

.pin-dialog form,
.share-dialog form,
.flow-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.pin-dialog h2,
.pin-dialog p {
  margin: 0;
}

.pin-dialog h2 {
  font-size: 18px;
}

.pin-dialog p {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.pin-dialog input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.pin-error {
  margin-top: -4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.pin-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.flow-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.pin-dialog menu button,
.share-dialog menu button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
}

#pinCancelButton {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-heading > div {
  min-width: 0;
}

.dialog-heading .icon-button {
  flex: 0 0 36px;
  align-self: flex-start;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
}

.dialog-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.progressive-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(15 15 15 / 0.03);
  animation: rowIn 0.24s var(--ease);
}

.progressive-block.field-disabled {
  border-color: var(--line);
  background: var(--page);
  box-shadow: none;
  opacity: 0.62;
}

.progressive-block:not(.field-disabled) input:not([type="checkbox"]) {
  border-color: var(--line-strong);
  opacity: 1;
}

.progressive-block:not(.field-disabled) .subtle-check {
  color: var(--muted);
}

.join-code-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--page);
}

.modal-code-input {
  width: 100%;
  min-height: 66px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 34px;
  text-align: center;
  letter-spacing: 0.22em;
}

.share-stack {
  display: grid;
  grid-template-columns: minmax(190px, 0.82fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.share-code-card,
.share-link-card,
.share-qr-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  animation: rowIn 0.24s var(--ease);
}

.share-code-card,
.share-link-card {
  cursor: pointer;
  transition:
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.share-code-card {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 228px;
  padding: 18px;
  text-align: left;
}

.share-code-card:hover,
.share-code-card:focus-visible,
.share-link-card:hover,
.share-link-card:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: 0 8px 22px rgb(15 15 15 / 0.06);
  outline: none;
}

.share-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.share-code-card #shareCodeValue {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.08em;
}

.share-pin-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.share-pin-row output {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.share-eye-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.share-eye-button:hover,
.share-eye-button:focus-visible {
  color: var(--text);
  outline: none;
}

.share-eye-button svg {
  width: 16px;
  height: 16px;
}

.share-link-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.share-link-card {
  display: grid;
  gap: 7px;
  width: 100%;
  border-color: var(--line);
  padding: 14px;
  color: inherit;
  text-align: left;
}

.share-link-card output {
  overflow: hidden;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-qr-card {
  display: grid;
  min-height: 164px;
  place-items: center;
  padding: 12px;
  background: var(--surface);
}

.share-qr-card img {
  display: block;
  width: min(176px, 100%);
  height: auto;
  border-radius: 4px;
}

.share-qr-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.share-dialog menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(12px) scale(0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease);
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cursor-tooltip {
  position: fixed;
  z-index: 80;
  max-width: 180px;
  transform: translateY(-100%);
  border-radius: 5px;
  padding: 3px 7px;
  box-shadow: 0 8px 18px rgb(15 15 15 / 0.12);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0.86;
  overflow: hidden;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .home-view {
    padding-top: 34px;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .app-main {
    min-height: calc(100dvh - 56px);
  }

  .workspace-header {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }

  .toolbar {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
  }

  .presence-control {
    flex: 0 0 auto;
  }

  .activity-status {
    display: none !important;
  }

  .toolbar .ghost-button,
  .toolbar .icon-button {
    width: 38px;
    min-width: 38px;
    height: 36px;
    min-height: 36px;
    flex: 0 0 38px;
    gap: 0;
    padding: 0;
  }

  .toolbar .ghost-button > span:not(#presenceCount) {
    display: none;
  }

  #createPin,
  #joinPin,
  #pinDialogInput {
    font-size: 16px;
  }

  .workspace-body {
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: hidden;
  }

  .workspace-view {
    height: calc(100dvh - 56px);
    min-height: 0;
  }

  #editor {
    height: 100%;
    min-height: 0;
  }

  .editor-shell {
    height: 100%;
    border-right: 0;
  }

  .presence-panel {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .app-header {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    min-height: 52px;
    padding: 8px 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    overflow: hidden;
    max-width: 42vw;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .status-pill {
    min-height: 26px;
    padding: 0 9px;
  }

  .app-main {
    min-height: calc(100dvh - 52px);
  }

  .workspace-view {
    height: calc(100dvh - 52px);
  }

  .home-title h1 {
    font-size: 36px;
  }

  .panel {
    padding: 14px;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .recent-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .share-stack {
    grid-template-columns: 1fr;
  }

  .share-code-card {
    min-height: 152px;
  }

  .share-code-card #shareCodeValue {
    font-size: 36px;
  }

  .recent-expiry.expired {
    max-width: 128px;
  }

  .recent-open {
    display: none;
  }

  .session-strip {
    align-items: center;
    gap: 8px;
  }

  .note-title-button,
  .note-title-input,
  .self-badge {
    max-width: calc(100vw - 138px);
  }

  .tool-select,
  .tool-range,
  .toggle {
    flex: 1 1 132px;
  }

  .tool-select select,
  .tool-range input {
    width: 100%;
  }

}

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