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

:root {
  --primary: #5966ff;
  --secondary: #4a43c8;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #222222;
  --muted: #666666;
  --border: #e3e7f2;
  --shadow: rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.dark-mode {
  background: #111316;
  color: #f3f4f7;
}

.header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 1rem 1.5rem;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
}

.user-status {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.header-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-small,
.btn-primary,
.btn-secondary,
.btn-danger,
.link-button {
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-small,
.btn-secondary,
.link-button {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 0.85rem 1.2rem;
  font-weight: 600;
}

.btn-danger {
  background: #ef5350;
  color: #fff;
  padding: 0.85rem 1.2rem;
  font-weight: 600;
}

.btn-secondary {
  background: #eef1ff;
  color: var(--text);
  padding: 0.85rem 1rem;
}

.link-button {
  background: transparent;
  color: var(--text);
  text-decoration: underline;
}

.main-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  padding: 1.25rem;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  height: calc(100vh - 96px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section h3 {
  margin-bottom: 0.85rem;
  color: var(--primary);
}

.notes-list,
.slides-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 320px;
  overflow-y: auto;
}

.note-item {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: #f5f7ff;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.note-item:hover {
  transform: translateX(4px);
}

.note-item.active {
  background: var(--primary);
  color: #fff;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.5rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-content {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  min-height: 540px;
}

.tab-content.active {
  display: block;
}

.editor-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.note-title-input {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  font-size: 1rem;
}

.memo-textarea {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem;
  resize: vertical;
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.7;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.slide-card {
  background: #f8f9ff;
  border-radius: 24px;
  padding: 1rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slide-card-header {
  display: flex;
  justify-content: flex-start;
}

.slide-mode-buttons {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.mode-btn {
  background: #eef1ff;
  border: none;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
}

.mode-btn.active {
  background: var(--primary);
  color: #fff;
}

.slide-area {
  position: relative;
  min-height: 440px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}

.slide-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.slide-layer {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.slide-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
  touch-action: none;
}

.slide-area.drawing-active .slide-text-box,
.slide-area.drawing-active .slide-photo-item {
  pointer-events: none;
}

.slide-text-box.selected,
.slide-photo-item.selected {
  box-shadow: 0 0 0 3px rgba(89, 102, 255, 0.35);
}

.draw-tools {
  display: none;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.8rem;
  background: #eef1ff;
  border-radius: 18px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--text);
}

.slider {
  width: 150px;
}

.color-input {
  width: 40px;
  height: 40px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.slide-text-box,
.slide-photo-item {
  position: absolute;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
}

.text-box-handle,
.photo-handle {
  cursor: move;
  padding: 0.55rem 0.75rem;
  background: rgba(90, 102, 255, 0.1);
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.text-box-body {
  padding: 0.85rem;
  min-height: 80px;
  overflow: auto;
  outline: none;
}

.slide-photo-item img {
  width: 100%;
  height: calc(100% - 2rem);
  object-fit: cover;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.text-box-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #ef5350;
  color: #fff;
  cursor: pointer;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.gallery-item img {
  width: 100%;
  display: block;
}

.gallery-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
}

.empty-gallery {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: min(520px, 90vw);
  background: var(--surface);
  border-radius: 24px;
  padding: 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-field input {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.auth-hidden {
  display: none;
}

.ad-container {
  margin: 1rem 1.25rem 1.25rem;
}

.ad-placeholder {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
}

body.dark-mode .sidebar,
body.dark-mode .tab-content,
body.dark-mode .slide-card,
body.dark-mode .modal-content,
body.dark-mode .ad-placeholder,
body.dark-mode .btn-secondary,
body.dark-mode .note-item,
body.dark-mode .gallery-item {
  background: #1f2229;
  color: #f3f4f7;
}

body.dark-mode .note-item.active {
  background: #3f4bff;
}

body.dark-mode .btn-secondary {
  background: #2a2f3c;
}

body.dark-mode .slide-area {
  background: #15181f;
}

body.dark-mode .slide-placeholder {
  color: #a0a6b8;
}
