@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600&display=swap');

:root {
  --pad: 14px;
  --bar-h: 52px;
  --accent: #a0b4ff;
  --accent-glow: rgba(160,180,255,0.15);
  --glass-bg: rgba(255,255,255,0.06);
  --glass-bg-hover: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.10);
  --glass-blur: blur(36px) saturate(160%);
  --glass-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.09);
  --text: rgba(255,255,255,0.9);
  --text-muted: rgba(255,255,255,0.5);
  --text-dim: rgba(255,255,255,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: radial-gradient(ellipse 160% 100% at 30% -5%, #1a1f3c 0%, #0c0c18 50%, #060609 100%);
  color: var(--text);
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.navigation {
  position: fixed;
  top: var(--pad);
  left: 50%;
  transform: translateX(-50%);
  height: var(--bar-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.navigation h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  padding: 0 8px 0 2px;
  flex-shrink: 0;
  line-height: 1;
}

.sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.11);
  margin: 0 6px;
  flex-shrink: 0;
}

.icon-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.icon-wrap:hover {
  background: var(--glass-bg-hover);
  transform: scale(1.08);
}

.icon-wrap.active {
  background: var(--accent-glow);
}

.icon-wrap .material-icons-round {
  font-size: 20px;
  color: var(--text-muted);
  display: block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  transition: color 0.15s ease;
}

.icon-wrap:hover .material-icons-round {
  color: var(--text);
}

.icon-wrap.active .material-icons-round {
  color: var(--accent);
}

.color-wrap {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.18);
  cursor: pointer;
}

.color-wrap input[type="color"] {
  width: 200%;
  height: 200%;
  margin: -50%;
  border: none;
  padding: 0;
  cursor: pointer;
}

.font-size {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  flex-shrink: 0;
}

.font-size span {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 3px;
  background: rgba(255,255,255,0.14);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.right-dock {
  position: fixed;
  right: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 999px;
}

.dbutton-wrap {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.dbutton-wrap:hover {
  background: var(--glass-bg-hover);
  transform: scale(1.09);
}

.dbutton-wrap .material-icons-round {
  font-size: 20px;
  color: var(--text-muted);
  display: block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  transition: color 0.15s ease;
}

.dbutton-wrap:hover .material-icons-round {
  color: var(--text);
}

.dbutton-wrap.accent .material-icons-round {
  color: var(--accent);
}

.rdock-sep {
  width: 20px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 2px 0;
}

.editor-container {
  position: fixed;
  top: calc(var(--bar-h) + var(--pad) + 12px);
  left: 0;
  right: calc(var(--pad) + 44px + 8px);
  bottom: 0;
  overflow: hidden;
}

#text-input {
  width: 100%;
  height: 100%;
  padding: 32px 40px 32px clamp(18px, 5vw, 64px);
  outline: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.82);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  caret-color: var(--accent);
  overflow-y: auto;
  scrollbar-width: none;
}

#text-input::-webkit-scrollbar { display: none; }

#text-input:empty::before {
  content: 'Start writing…';
  color: var(--text-dim);
  pointer-events: none;
}

#draw-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .navigation {
    left: var(--pad);
    right: var(--pad);
    transform: none;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .navigation::-webkit-scrollbar { display: none; }

  .right-dock {
    flex-direction: row;
    top: auto;
    right: 50%;
    bottom: calc(var(--pad) + 4px);
    transform: translateX(50%);
    border-radius: 999px;
    padding: 6px 10px;
  }

  .rdock-sep {
    width: 1px;
    height: 20px;
    margin: 0 2px;
  }

  .editor-container {
    left: 0;
    right: 0;
    bottom: calc(var(--pad) + 56px + 8px);
  }
}

.settings {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: min(420px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.settings h2 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.setting-item {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 14px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.setting-item:hover {
  transform: scale(1.01);
  background: rgba(255, 255, 255, 0.07);
}

.setting-item p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  flex: 1;
}

.toggle {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: all 0.25s ease;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 4px;
  left: 4px;
  border-radius: 50%;
  background: white;
  transition: transform 0.25s ease;
}

.toggle.active {
  background: rgba(122, 162, 255, 0.9);
}

.toggle.active::after {
  transform: translateX(20px);
}

input[type="color"] {
  width: 42px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

select {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  outline: none;
}

.settings.hidden {
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.98);
  pointer-events: none;
}

@media (max-width: 420px) {
  .settings {
    padding: 16px;
    gap: 12px;
  }

  .setting-item {
    margin-top: 5px;
    padding: 10px 12px;
  }

  .setting-item p {
    font-size: 13px;
  }
}