:root {
  --bg: #fbfbff;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-solid: #ffffff;
  --ink: #070712;
  --muted: #6f7080;
  --soft: #f5f4ff;
  --line: rgba(15, 15, 30, 0.09);
  --purple: #6f3cff;
  --purple-2: #8d6bff;
  --blue: #246bff;
  --cyan: #16c7ff;
  --pink: #ff76d7;
  --yellow: #fff2a8;
  --shadow: 0 22px 70px rgba(27, 19, 88, 0.12);
  --shadow-tight: 0 12px 34px rgba(32, 25, 92, 0.11);
  --font-display: "Plus Jakarta Sans", sans-serif;
  --font-body: "Plus Jakarta Sans", sans-serif;
}

* { box-sizing: border-box; }

@keyframes haloDrift {
  0%, 100% { transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { transform: translate3d(2%, 1%, 0) scale(1.05); }
}

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

@keyframes orbitGlow {
  0%, 100% { box-shadow: 0 0 0 5px rgba(111, 60, 255, 0.1), 0 12px 28px rgba(111, 60, 255, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(36, 107, 255, 0.1), 0 16px 34px rgba(255, 118, 215, 0.18); }
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 330px 1fr;
  background:
    radial-gradient(circle at 47% 9%, rgba(111, 60, 255, 0.15), transparent 25vw),
    radial-gradient(circle at 72% 13%, rgba(255, 118, 215, 0.16), transparent 24vw),
    radial-gradient(circle at 12% 8%, rgba(22, 199, 255, 0.11), transparent 18vw),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 48%, #ffffff 100%);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(111, 60, 255, 0.28) 1px, transparent 0),
    radial-gradient(circle at 50% 0%, rgba(111, 60, 255, 0.12), transparent 32vw);
  background-size: 34px 34px, 100% 100%;
  mask-image: linear-gradient(to bottom, black 0%, transparent 58%);
  animation: haloDrift 15s ease-in-out infinite;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  top: -18vw;
  left: 18vw;
  width: 62vw;
  height: 34vw;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 118, 215, 0.12), rgba(111, 60, 255, 0.08) 44%, transparent 72%);
  filter: blur(22px);
  pointer-events: none;
}

button, textarea, input {
  font: inherit;
}

a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.sidebar {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 22px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(160%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  animation: enterSoft 0.45s ease both;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  animation: orbitGlow 4s ease-in-out infinite;
}

.brand strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(245, 244, 255, 0.72);
  border-radius: 12px;
  animation: enterSoft 0.45s 0.05s ease both;
}

.tab, .icon-button, .primary-button, .ghost-button {
  border: 0;
  cursor: pointer;
}

.tab {
  min-height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  font-size: 0.8rem;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tab:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.tab.active {
  background: white;
  color: var(--purple);
  box-shadow: var(--shadow-tight);
}

.panel { display: none; }
.panel.active {
  display: block;
  animation: enterSoft 0.35s ease both;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel h2 {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--purple);
}

.panel-tools {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(7, 7, 18, 0.13);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  background: var(--purple);
  box-shadow: 0 16px 34px rgba(111, 60, 255, 0.24);
}

.icon-button input { display: none; }

.file-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.file-item {
  width: 100%;
  text-align: left;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(24, 22, 70, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.file-item:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 60, 255, 0.28);
  box-shadow: var(--shadow-tight);
}

.file-item.active {
  border-color: rgba(111, 60, 255, 0.4);
  background:
    linear-gradient(135deg, rgba(111, 60, 255, 0.08), rgba(22, 199, 255, 0.04)),
    white;
  box-shadow: 0 18px 44px rgba(111, 60, 255, 0.13);
}

.file-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
}

.file-item small {
  color: var(--muted);
  font-size: 0.71rem;
}

.workspace {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  padding: 18px 28px;
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(24px) saturate(160%);
  animation: enterSoft 0.45s 0.08s ease both;
}

.header-copy {
  display: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.19em;
  font-size: 0.7rem;
  font-weight: 900;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(1.8rem, 4.2vw, 4.6rem);
  font-weight: 950;
  letter-spacing: -0.075em;
  color: var(--ink);
  line-height: 0.94;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.actions > div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button, .ghost-button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  font-weight: 900;
  font-size: 0.82rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
  background: var(--ink);
  color: white;
  box-shadow: 0 13px 30px rgba(7, 7, 18, 0.13);
}

.ghost-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(24, 22, 70, 0.05);
}

.primary-button:hover, .ghost-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(111, 60, 255, 0.16);
}

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

.empty-state {
  max-width: 730px;
  margin: auto;
  padding: 42px;
  text-align: center;
  animation: enterSoft 0.5s 0.14s ease both;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 6vw, 5.4rem);
  letter-spacing: -0.085em;
  color: var(--ink);
  line-height: 0.9;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

.empty-state code {
  color: var(--purple);
  background: var(--soft);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.note-view {
  flex: 1;
  min-height: 0;
  display: block;
  padding: 22px;
  animation: enterSoft 0.35s ease both;
}

.editor-column {
  height: 100%;
  min-height: 0;
}

textarea {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 172px);
  resize: none;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  line-height: 1.68;
  outline: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

textarea:focus {
  border-color: rgba(111, 60, 255, 0.5);
  box-shadow: 0 0 0 5px rgba(111, 60, 255, 0.08), var(--shadow);
}

.markdown-preview {
  min-width: 0;
  height: 100%;
  min-height: calc(100vh - 172px);
  overflow: auto;
  padding: 40px 48px 68px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  line-height: 1.75;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.skill-note-deck {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.skill-note-slide {
  position: relative;
  width: min(100%, 1100px);
  min-height: min(72vh, 760px);
  overflow: hidden;
  padding: clamp(2rem, 5vw, 5rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 52% 12%, rgba(111, 60, 255, 0.13), transparent 26vw),
    radial-gradient(circle at 80% 8%, rgba(255, 118, 215, 0.12), transparent 22vw),
    linear-gradient(180deg, #fff, #fbfbff);
  box-shadow: var(--shadow);
}

.skill-note-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(111, 60, 255, 0.23) 1px, transparent 0);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  pointer-events: none;
}

.skill-note-slide > * {
  position: relative;
  z-index: 1;
}

.note-eyebrow {
  display: inline-flex;
  width: auto;
  margin: 0 0 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(111, 60, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--purple);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  color: var(--ink);
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.markdown-preview h1 {
  font-size: clamp(2rem, 5vw, 4.8rem);
}

.markdown-preview a,
.markdown-preview strong {
  color: var(--purple);
}

.markdown-preview blockquote {
  margin: 18px 0;
  padding: 12px 0 12px 18px;
  border-left: 3px solid var(--purple);
  color: var(--muted);
  background: linear-gradient(90deg, rgba(111, 60, 255, 0.08), transparent);
}

.markdown-preview code {
  padding: 0.15em 0.35em;
  border-radius: 6px;
  color: var(--blue);
  background: var(--soft);
}

.markdown-preview pre {
  padding: 16px;
  overflow: auto;
  border-radius: 14px;
  background: #080815;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.deck-view {
  flex: 1;
  min-height: 0;
  padding: 22px;
  animation: enterSoft 0.35s ease both;
}

iframe {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}

.hidden { display: none; }

.toast {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: 0 18px 42px rgba(7, 7, 18, 0.22);
}

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

.login-page {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(160%);
  animation: enterSoft 0.45s ease both;
}

.login-brand {
  min-height: auto;
}

.login-eyebrow {
  margin: 0 0 8px;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 900;
}

.login-title {
  max-width: 9ch;
  font-size: clamp(2.4rem, 8vw, 4.6rem);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.login-form input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.login-form input:focus {
  border-color: rgba(111, 60, 255, 0.5);
  box-shadow: 0 0 0 5px rgba(111, 60, 255, 0.08);
}

.login-error {
  display: none;
  margin: 0;
  color: #cf2342;
  font-size: 0.82rem;
  font-weight: 800;
}

.login-failed .login-error {
  display: block;
}

.login-button {
  justify-content: center;
  margin-top: 4px;
}

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

@media (max-width: 920px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .editor-column { min-height: 320px; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
