@import url('fonts.css');

/* ─── Reset & Base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:           #f7f4f0;
  --white:        #fdfcfb;
  --text:         #1a1a1a;
  --muted:        #aaa;
  --line:         #e0dbd5;
  --accent:       #1a1a1a;
  --accent-light: rgba(26,26,26,0.06);
  --canvas-bg:    #fdfcfb;
  --danger:       #c0392b;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
  --radius:       0;
  --transition:   0.25s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.04em;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

/* ─── Login View ─── */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
}

.login-box {
  text-align: center;
  width: 320px;
}

.login-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 48px;
  color: var(--text);
}

.login-box input[type="password"] {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color var(--transition);
  text-align: center;
}

.login-box input[type="password"]:focus {
  border-color: var(--muted);
}

.login-box input[type="password"]::placeholder {
  color: var(--muted);
}

.login-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 13px 28px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  margin-top: 16px;
}

.login-submit:hover {
  border-color: var(--text);
  color: var(--text);
}

.login-error {
  font-size: 11px;
  color: var(--danger);
  letter-spacing: 0.04em;
  margin-top: 16px;
  min-height: 18px;
}

/* ─── App Layout ─── */
.app-view {
  display: none;
  flex-direction: column;
  height: 100vh;
}

.app-view.active { display: flex; }
.login-view.active { display: flex; }
.login-view { display: none; }

/* ─── Top Bar ─── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  position: relative;
  flex-shrink: 0;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hide edit tools by default (presentation mode) */
.toolbar-center { display: none; }
.app-view.mobile-edit .toolbar-center { display: flex; }

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin-right: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition);
}

.logo:hover { opacity: 0.5; }

.board-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text);
  padding: 4px 8px;
  outline: none;
  border: 1px solid transparent;
  transition: all var(--transition);
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
}

.board-name:hover { border-color: var(--line); }
.board-name:focus { border-color: var(--muted); background: var(--white); }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.tb-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.tb-btn:active {
  background: var(--accent-light);
}

.tb-btn svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.tb-btn:hover svg { opacity: 1; }

.tb-sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 8px;
}

.board-select {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  max-width: 180px;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.board-select:hover { border-color: var(--text); color: var(--text); }
.board-select:focus { outline: none; border-color: var(--muted); }

.tb-btn-new {
  font-size: 18px;
  font-weight: 300;
  padding: 4px 14px;
  line-height: 1;
  color: var(--muted);
  border-color: var(--line);
}

.tb-btn-new:hover { color: var(--text); border-color: var(--text); }

.tb-btn-share {
  color: var(--muted);
  border-color: var(--line);
}

/* ─── Canvas ─── */
.canvas-wrapper {
  width: 100%;
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.canvas {
  position: relative;
  width: 1920px;
  height: 1080px;
  margin: 40px auto;
  background: var(--canvas-bg);
  box-shadow:
    0 0 0 1px var(--line),
    var(--shadow-lg);
  overflow: hidden;
  transition: background-color 0.4s ease;
}

.canvas.grid-on {
  background-image:
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ─── Board Items ─── */
.board-item {
  position: absolute;
  cursor: grab;
  transition: box-shadow var(--transition);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board-item:active { cursor: grabbing; }

.board-item.selected {
  outline: 1px solid var(--text);
  outline-offset: 4px;
}

.board-item.locked {
  cursor: default;
}

.board-item.locked::after {
  content: '\1F512';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  padding: 2px 5px;
  line-height: 1;
  pointer-events: none;
}

/* Images */
.board-item-img {
  box-shadow: var(--shadow-md);
}

.board-item-img:hover {
  box-shadow: var(--shadow-lg);
}

.board-item-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* Text */
.board-item-text {
  min-width: 60px;
  min-height: 30px;
  padding: 8px 14px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 300;
  color: var(--text);
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.board-item-text:focus {
  cursor: text;
  background: rgba(0,0,0,0.02);
}

.board-item-text::selection {
  background: var(--text);
  color: var(--bg);
}

/* ─── Resize / Rotate Handles ─── */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--white);
  border: 1.5px solid var(--text);
  z-index: 10;
  display: none;
  transition: transform 0.15s, background 0.15s;
}

.resize-handle:hover {
  transform: scale(1.3);
  background: var(--text);
}

.board-item.selected .resize-handle { display: block; }

.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

.rotate-handle {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: var(--white);
  border: 1.5px solid var(--text);
  border-radius: 50%;
  cursor: grab;
  z-index: 10;
  display: none;
  transition: transform 0.15s, background 0.15s;
}

.rotate-handle:hover {
  transform: translateX(-50%) scale(1.2);
  background: var(--text);
}

.rotate-handle::before {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  width: 1px;
  height: 11px;
  background: var(--text);
  transform: translateX(-50%);
  opacity: 0.3;
}

.board-item.selected .rotate-handle { display: block; }

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247,244,240,0.85);
  backdrop-filter: blur(8px);
  animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 32px;
  width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modal-slide-in 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-content input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color var(--transition);
}

.modal-content input[type="text"]:focus {
  border-color: var(--muted);
}

.modal-content input[type="text"]::placeholder {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn {
  padding: 10px 20px;
  border: 1px solid var(--line);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--text);
  color: var(--text);
}

.btn-primary {
  background: var(--text);
  color: var(--white);
  border-color: var(--text);
}

.btn-primary:hover {
  opacity: 0.7;
}

/* ─── Context Menu ─── */
.context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--white);
  border: 1px solid var(--line);
  padding: 6px;
  min-width: 190px;
  box-shadow: var(--shadow-lg);
  animation: ctx-in 0.15s ease;
}

@keyframes ctx-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.context-menu.hidden { display: none; }

.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.1s;
}

.context-menu button:hover {
  background: var(--accent-light);
  color: var(--text);
}

.context-menu .ctx-danger:hover {
  background: rgba(192,57,43,0.06);
  color: var(--danger);
}

.ctx-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 10px;
}

/* ─── Drag over ─── */
.canvas.drag-over {
  outline: 1px dashed var(--text);
  outline-offset: -8px;
}

/* ─── Scrollbar ─── */
.canvas-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
.canvas-wrapper::-webkit-scrollbar-track { background: transparent; }
.canvas-wrapper::-webkit-scrollbar-thumb { background: var(--line); }
.canvas-wrapper::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Empty State ─── */
.canvas:empty::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 1px dashed var(--line);
  opacity: 0.6;
}

.canvas:empty::after {
  content: 'Bilder hierher ziehen oder per Upload / URL hinzuf\00FCgen';
  position: absolute;
  top: calc(50% + 72px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.08em;
  pointer-events: none;
  text-align: center;
  max-width: 280px;
  line-height: 1.7;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 24px;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2s forwards;
  pointer-events: none;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

/* ─── Dashboard (board list) ─── */
.dashboard-view {
  display: none;
  flex-direction: column;
  height: 100vh;
}

.dashboard-view.active { display: flex; }

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.dashboard-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.dashboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 40px 28px;
  -webkit-overflow-scrolling: touch;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1200px;
}

.board-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 28px 24px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.board-card:hover {
  border-color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.board-card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.board-card-meta {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.board-card-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.board-card-actions button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition);
  padding: 0;
}

.board-card-actions button:hover { color: var(--text); }
.board-card-actions .btn-delete:hover { color: var(--danger); }

.board-card-new {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border-style: dashed;
  color: var(--muted);
}

.board-card-new:hover {
  color: var(--text);
  border-color: var(--text);
}

.board-card-new-inner {
  text-align: center;
}

.board-card-new-plus {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 8px;
}

.board-card-new-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ─── Share overlay ─── */
.share-url-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.share-url-box input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.02em;
  outline: none;
}

.share-url-box button {
  padding: 10px 16px;
  background: var(--text);
  color: var(--white);
  border: 1px solid var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity var(--transition);
}

.share-url-box button:hover { opacity: 0.7; }

/* ─── Presentation View (shared board view for desktop + mobile) ─── */
.pres-view {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 32px;
}

.pres-view.active { display: block; }

/* Concepts stacked vertically, images in grid within each */
.pres-columns {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: 1000px;
  margin: 0 auto;
}

.pres-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pres-column .mv-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pres-view .mv-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-top: 8px;
}

.pres-view .mv-desc {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #666;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.pres-view .mv-img {
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  overflow: hidden;
}

.pres-view .mv-img:hover {
  box-shadow: var(--shadow-lg);
}

.pres-view .mv-img {
  position: relative;
}

.pres-view .mv-img img {
  display: block;
  width: 100%;
  height: auto;
}

/* ─── Pres-view WYSIWYG Edit Mode ─── */

.pres-edit-wrapper {
  position: relative;
}

.pres-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}

.mv-img:hover .pres-delete-btn,
.pres-edit-wrapper:hover .pres-delete-btn {
  opacity: 1;
}

.pres-column [contenteditable="true"] {
  outline: none;
  border-radius: 3px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}

.pres-column [contenteditable="true"]:focus {
  background: rgba(0,0,0,0.04);
}

.pres-add-row {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

.pres-add-btn {
  padding: 6px 14px;
  border: 1px dashed var(--muted);
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.pres-add-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.pres-new-concept-btn {
  display: block;
  width: 100%;
  padding: 20px;
  margin-top: 12px;
  border: 2px dashed var(--muted);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s;
}

.pres-new-concept-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* ─── Mobile Lightbox ─── */
.mobile-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-fade-in 0.2s ease;
  cursor: pointer;
}

.mobile-lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
}

.mobile-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

/* ─── Responsive ─── */

@media (max-width: 960px) {
  .toolbar { padding: 0 16px; gap: 8px; }
  .toolbar-center .tb-btn { padding: 8px 10px; }
  .board-name { max-width: 160px; font-size: 14px; }
}

@media (max-width: 768px) {
  /* Toolbar: two rows on tablet */
  .toolbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 8px;
  }
  .toolbar-left { order: 1; flex: 1; }
  .toolbar-right { order: 2; }
  .toolbar-center { order: 3; width: 100%; justify-content: center; padding-top: 4px; border-top: 1px solid var(--line); }

  .canvas {
    width: 1200px;
    height: 800px;
    margin: 20px auto;
  }

  .modal-content { width: calc(100vw - 32px); max-width: 420px; }
  .dashboard-body { padding: 28px 20px; }
}

@media (max-width: 640px) {
  /* Toolbar: compact */
  .toolbar { padding: 8px 12px; gap: 6px; }
  .toolbar-left { min-width: 0; }
  .logo { font-size: 11px; letter-spacing: 0.08em; margin-right: 8px; }
  .board-name { max-width: 120px; font-size: 13px; padding: 3px 6px; }
  .tb-sep { margin: 0 4px; height: 20px; }

  .toolbar-right .tb-btn span { display: none; }
  .toolbar-right .tb-btn { padding: 8px; gap: 0; }

  .pres-view { padding: 16px; }
  .pres-column .mv-images { grid-template-columns: repeat(2, 1fr); }

  .app-view.mobile-edit .canvas {
    width: 900px;
    height: 600px;
    margin: 12px auto;
  }
  .app-view.mobile-edit .toolbar-center {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }
  .app-view.mobile-edit .toolbar-center .tb-btn span { display: none; }
  .app-view.mobile-edit .toolbar-center .tb-btn { padding: 8px; gap: 0; }

  /* Larger touch targets in edit mode */
  .app-view.mobile-edit .resize-handle { width: 16px; height: 16px; }
  .app-view.mobile-edit .resize-handle.nw { top: -8px; left: -8px; }
  .app-view.mobile-edit .resize-handle.ne { top: -8px; right: -8px; }
  .app-view.mobile-edit .resize-handle.sw { bottom: -8px; left: -8px; }
  .app-view.mobile-edit .resize-handle.se { bottom: -8px; right: -8px; }
  .app-view.mobile-edit .rotate-handle { width: 22px; height: 22px; top: -36px; }

  /* Dashboard mobile */
  .dashboard-header { padding: 16px; }
  .dashboard-title { font-size: 15px; letter-spacing: 0.12em; }
  .dashboard-body { padding: 16px 12px; }
  .board-grid { grid-template-columns: 1fr; gap: 12px; }
  .board-card { padding: 20px 16px; }

  .modal-content { width: calc(100vw - 24px); padding: 24px 20px; }
  .modal-content h3 { font-size: 16px; }

  .share-url-box { flex-direction: column; }
  .share-url-box button { align-self: flex-end; }

  /* Context menu bottom sheet */
  .context-menu {
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    animation: ctx-slide-up 0.2s ease;
  }
  @keyframes ctx-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .context-menu button { padding: 14px 20px; font-size: 13px; }
  .ctx-sep { margin: 4px 16px; }

  /* Login */
  .login-box { width: calc(100vw - 48px); max-width: 320px; }

  /* Toast */
  .toast { bottom: 16px; font-size: 12px; padding: 10px 20px; }
}

@media (max-width: 380px) {
  .logo { display: none; }
  .board-name { max-width: 140px; }
}
