* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  font-family: system-ui, -apple-system, sans-serif;
  color: #fff;
  padding: 1.5rem;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 0, 128, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 255, 200, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(100, 100, 255, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.card {
  position: relative;
  width: min(100%, 32rem);
  padding: 3rem 2.5rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  background: linear-gradient(90deg, #ff6ec7, #ffd93d, #6effc7, #6eb5ff, #c76eff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease infinite;
}

.subtitle {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.btn-create {
  margin-top: 2rem;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0f0c29;
  background: linear-gradient(90deg, #ff6ec7, #ffd93d, #6effc7);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-create:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 110, 199, 0.35);
}

.note-code {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: #6effc7;
}

.note-meta {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

.link-home {
  display: inline-block;
  margin-top: 2rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.9rem;
}

.link-home:hover {
  color: #ffd93d;
}

.error {
  margin-top: 1rem;
  color: #ff8fa3;
  font-size: 0.95rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.info-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.info-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.75rem;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.info-list li {
  display: flex;
  gap: 0.6rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

.info-list .info-icon {
  flex-shrink: 0;
  color: #6effc7;
}

.divider {
  margin: 1.75rem 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.join-form {
  display: flex;
  gap: 0.5rem;
}

.code-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
}

.code-input:focus {
  border-color: rgba(110, 255, 199, 0.4);
  box-shadow: 0 0 0 3px rgba(110, 255, 199, 0.12);
}

.code-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  color: rgba(255, 255, 255, 0.35);
}

.btn-join {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f0c29;
  background: linear-gradient(90deg, #6eb5ff, #6effc7);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn-join:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(110, 181, 255, 0.35);
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

body.note-page {
  display: block;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

html.note-page-root,
html.note-page-root body {
  height: 100%;
}

.note-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.75rem;
  gap: 0.5rem;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.note-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.note-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.note-header .link-home {
  margin-top: 0;
  white-space: nowrap;
}

.note-header .note-code {
  margin-top: 0;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
}

.btn-toolbar {
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-toolbar:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-toolbar.is-copied {
  color: #6effc7;
  border-color: rgba(110, 255, 199, 0.45);
  background: rgba(110, 255, 199, 0.12);
}

.btn-toolbar.is-active {
  color: #6eb5ff;
  border-color: rgba(110, 181, 255, 0.45);
  background: rgba(110, 181, 255, 0.12);
}

.connection-status {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.status-connecting {
  color: #ffd93d;
  background: rgba(255, 217, 61, 0.1);
}

.status-live {
  color: #6effc7;
  background: rgba(110, 255, 199, 0.1);
}

.status-offline,
.status-error {
  color: #ff8fa3;
  background: rgba(255, 143, 163, 0.1);
}

.note-pad-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  overflow: hidden;
}

.note-pad-wrap.theme-dark {
  background:
    linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)),
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(255, 255, 255, 0.05) 28px
    );
  background-color: #1c1c1e;
  color: #e8e8ea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.note-pad-wrap.theme-dark:focus-within {
  border-color: rgba(110, 255, 199, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px rgba(110, 255, 199, 0.08);
}

.note-pad-wrap.theme-light {
  background:
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(0, 0, 0, 0.06) 28px
    );
  background-color: #faf8f2;
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.note-pad-wrap.theme-light:focus-within {
  border-color: rgba(80, 120, 200, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 0 0 3px rgba(80, 120, 200, 0.12);
}

.line-numbers {
  display: none;
  flex-shrink: 0;
  padding: 1rem 0.75rem;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  opacity: 0.4;
  border-right: 1px solid currentColor;
}

.note-pad-wrap.code-mode .line-numbers {
  display: block;
}

.note-pad-wrap.code-mode .note-pad {
  white-space: pre;
  overflow-x: auto;
}

.note-pad {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  overflow-y: auto;
}

.note-pad:disabled {
  opacity: 0.65;
  cursor: wait;
}

.note-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0 0.25rem;
}

.char-count {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
}

.char-count.is-limit {
  color: #ff8fa3;
}
