html, body { margin: 0; height: 100%; background: #17181a; color: #ebeae6; font-family: 'Instrument Sans', Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
.mono { font-family: 'IBM Plex Mono', monospace; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.shell { display: flex; height: 100vh; height: 100dvh; font-size: 14px; overflow: hidden; }

/* Navigation */
.side { width: 216px; flex: none; border-right: 1px solid #26272b; padding: 28px 20px; display: flex; flex-direction: column; gap: 6px; }
.logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; padding: 0 8px; }
.logo .dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle, #17181a 0 27%, #e2603f 29%); }
.logo .brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav-btn { all: unset; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: #8e8f95; background: transparent; }
.nav-btn:hover { background: #222327; }
.nav-btn.on { color: #ebeae6; background: #222327; }
.nav-btn.profile { margin-top: auto; }
.nav-summary { padding: 0 10px; color: #6f7076; font-size: 12px; line-height: 1.5; }

.main { flex: 1; min-width: 0; overflow: auto; position: relative; }
.page { padding: 40px 48px; max-width: 1200px; }
.page.profile { max-width: 860px; display: flex; flex-direction: column; gap: 40px; }
.title { margin: 0 0 20px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.page.boards .title { margin-bottom: 32px; }
.page.profile .title { margin-bottom: 6px; }
.lead { margin: 0; color: #8e8f95; }

/* Gallery */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { border: 1px solid #2c2d32; background: transparent; color: #b9b9bf; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; }
.chip:hover { border-color: #4a4b52; }
.chip.on { border-color: #ebeae6; background: #ebeae6; color: #17181a; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.motif { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.motif:hover { opacity: 0.85; }
.motif-img { aspect-ratio: 1; width: 100%; border-radius: 12px; overflow: hidden; background: #1e1f23; border: 1px solid #26272b; padding: 16%; }
.motif-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.motif-name { font-size: 13px; color: #b9b9bf; padding: 0 2px; }

/* My boards */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 32px; border: 1px dashed #3a3b41; border-radius: 12px; color: #8e8f95; max-width: 420px; margin-bottom: 16px; }
.empty-title { color: #ebeae6; font-weight: 500; }
.empty-text { font-size: 13px; line-height: 1.5; }
.card { display: flex; flex-direction: column; gap: 8px; background: #1e1f23; border: 1px solid #26272b; border-radius: 12px; padding: 12px; }
.card.on { border-color: #3a3b41; }
.card-open { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.card-open:hover { opacity: 0.85; }
.card-thumb { aspect-ratio: 1; width: 100%; background: #17181a; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-thumb img { width: 85%; height: 85%; object-fit: contain; image-rendering: pixelated; }
.card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 11px; color: #8e8f95; }
.card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; border-top: 1px solid #26272b; }
.status { font-size: 11px; color: #8e8f95; }
.status.edited { color: #e2603f; }
.link-btn { all: unset; cursor: pointer; color: #6f7076; font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.link-btn:hover { color: #ebeae6; background: #26272b; }

/* Pattern editor */
.pattern { display: flex; height: 100%; }
.editor { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 20px 28px; border-bottom: 1px solid #26272b; }
.back { all: unset; cursor: pointer; color: #8e8f95; font-size: 13px; padding: 6px 10px 6px 0; }
.back:hover { color: #ebeae6; }
.name-input { background: transparent; border: 0; outline: none; color: #ebeae6; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; min-width: 160px; flex: 1 1 160px; padding: 4px 0; border-bottom: 1px solid transparent; }
.name-input:focus { border-bottom-color: #3a3b41; }
.summary { font-size: 12px; color: #8e8f95; white-space: nowrap; }
.warn-btn { border: 1px solid #5a2e24; background: #2a1a16; color: #f0a090; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; }
.warn-btn:hover { border-color: #e2603f; }
.ghost-btn { border: 1px solid #4a4b52; background: transparent; color: #b9b9bf; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; }
.ghost-btn:hover { border-color: #ebeae6; color: #ebeae6; }
.hint { font-size: 12px; color: #6f7076; }
.board-wrap { flex: 1; min-height: 0; overflow: auto; padding: 28px; display: flex; align-items: flex-start; justify-content: center; }
.board { display: block; border-radius: 6px; border: 1px solid #26272b; cursor: crosshair; touch-action: none; }

.panel { width: 280px; flex: none; border-left: 1px solid #26272b; padding: 20px; display: flex; flex-direction: column; gap: 20px; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.label { font-size: 12px; color: #8e8f95; text-transform: uppercase; letter-spacing: 0.06em; }
.link-accent { all: unset; cursor: pointer; font-size: 12px; color: #e2603f; }
.link-accent:hover { color: #ebeae6; }
.colors { display: flex; flex-direction: column; gap: 2px; }
.color-row { display: flex; flex-direction: column; border-radius: 8px; }
.color-row.editing { background: #1e1f23; }
.color-main { display: flex; align-items: center; gap: 10px; padding: 7px 8px; }
.color-main.dim { opacity: 0.45; }
.color-btn { all: unset; cursor: pointer; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.color-btn:hover { opacity: 0.8; }
.bead { width: 18px; height: 18px; border-radius: 50%; flex: none; background: radial-gradient(circle, #17181a 0 26%, var(--c) 28%); outline: 2px solid transparent; outline-offset: 2px; }
.bead.ring { outline-color: #ebeae6; }
.bead.lg { width: 22px; height: 22px; }
.color-icon { width: 18px; height: 18px; flex: none; display: flex; align-items: center; justify-content: center; }
.color-icon img { width: 16px; height: 16px; display: block; }
.color-name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { font-size: 12px; min-width: 36px; text-align: right; }
.swap-btn { all: unset; cursor: pointer; width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #8e8f95; font-size: 14px; flex: none; }
.swap-btn:hover { background: #2c2d32; color: #ebeae6; }
.swap-box { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.swap-box .note { font-size: 11px; color: #8e8f95; }
.swap-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swap-opt { all: unset; cursor: pointer; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #17181a 0 26%, var(--c) 28%); }
.swap-opt:hover { outline: 2px solid #ebeae6; outline-offset: 2px; }
.total { display: flex; justify-content: space-between; padding: 10px 8px 0; border-top: 1px solid #26272b; margin-top: 8px; font-size: 13px; color: #8e8f95; }
.total span { color: #ebeae6; }

/* Profile */
.section-label { font-size: 12px; color: #8e8f95; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.plates { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.plate-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid #26272b; border-radius: 10px; background: #1e1f23; }
.plate-ico { width: 22px; height: 22px; border-radius: 3px; border: 1px solid #4a4b52; background: repeating-linear-gradient(0deg, transparent 0 3px, #2c2d32 3px 4px), repeating-linear-gradient(90deg, transparent 0 3px, #2c2d32 3px 4px); flex: none; }
.plate-label { flex: 1; font-weight: 500; }
.plate-meta { font-size: 12px; color: #8e8f95; }
.plate-row .link-btn { color: #8e8f95; padding: 4px 8px; }
.add-plate { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px; border: 1px dashed #3a3b41; border-radius: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #8e8f95; }
.field.grow { flex: 1 1 160px; }
.input { background: #1e1f23; color: #ebeae6; border: 1px solid #2c2d32; border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; }
.input.num { width: 70px; font-family: 'IBM Plex Mono', monospace; }
.dims { display: flex; align-items: center; gap: 6px; }
.btn-primary { border: 0; background: #ebeae6; color: #17181a; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 8px; }
.btn-primary:hover { background: #fff; }
.btn-primary.small { font-size: 13px; padding: 9px 14px; }
.btn-outline { border: 1px solid #2c2d32; background: transparent; color: #ebeae6; border-radius: 8px; padding: 10px 16px; font-size: 14px; }
.btn-outline:hover { border-color: #4a4b52; }
.colors-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.text-btns { display: flex; gap: 12px; }
.text-btn { all: unset; cursor: pointer; color: #8e8f95; font-size: 12px; }
.text-btn:hover { color: #ebeae6; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.own { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #26272b; background: transparent; opacity: 0.4; }
.own:hover { border-color: #4a4b52; }
.own.on { border-color: #3a3b41; background: #1e1f23; opacity: 1; }
.own-icon { width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center; }
.own-icon img { width: 20px; height: 20px; display: block; }
.own-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.own-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.own-sub { font-size: 11px; color: #8e8f95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.own-n { font-size: 11px; color: #8e8f95; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 13px; color: #b9b9bf; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: #ebeae6; margin: 0; }

/* Overlays */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #ebeae6; color: #17181a; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; animation: rise 0.2s ease-out; z-index: 20; }
.overlay { position: fixed; inset: 0; background: rgba(10, 10, 12, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 24px; overflow: auto; }
.dialog { background: #1e1f23; border: 1px solid #2c2d32; border-radius: 16px; animation: rise 0.25s ease-out; }
.picker { width: 100%; max-width: 760px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: auto; padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.pick-left { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.pick-box { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #17181a; padding: 12px; display: flex; align-items: center; justify-content: center; }
.pick-box.result { border: 1px solid #26272b; }
.pick-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pick-box.result img { image-rendering: pixelated; }
.pick-cap { font-size: 11px; color: #8e8f95; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 4px; }
.pick-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pick-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-label { font-size: 12px; color: #8e8f95; text-transform: uppercase; letter-spacing: 0.06em; }
.step-label.gap { margin-top: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { border: 2px solid #2c2d32; background: transparent; color: #ebeae6; border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 500; }
.preset:hover { border-color: #4a4b52; }
.preset.on { border-color: #ebeae6; background: #2c2d32; }
.plates-row { display: flex; align-items: center; gap: 20px; }
.stepper { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-btn { border: 2px solid #2c2d32; background: #17181a; color: #ebeae6; width: 48px; height: 40px; border-radius: 12px; font-size: 22px; line-height: 1; }
.step-btn:hover { border-color: #4a4b52; }
.step-val { display: flex; flex-direction: column; align-items: center; min-width: 90px; padding: 4px 0; }
.step-num { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.step-sub { font-size: 12px; color: #8e8f95; }
.tiles { display: grid; gap: 3px; width: 120px; height: 120px; }
.tile { border-radius: 4px; background: #2c2d32; border: 1px solid #3a3b41; min-width: 0; min-height: 0; }
.need { font-size: 13px; color: #b9b9bf; padding-top: 10px; border-top: 1px solid #26272b; }
.need span { color: #ebeae6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 8px; }

.ob { width: 440px; max-width: 100%; padding: 36px; display: flex; flex-direction: column; gap: 18px; }
.dots { display: flex; gap: 6px; }
.dot-bar { width: 24px; height: 3px; border-radius: 2px; background: #2c2d32; }
.dot-bar.on { background: #ebeae6; }
.ob h2 { margin: 8px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.ob p { margin: 0; color: #b9b9bf; line-height: 1.6; font-size: 15px; }
.ob-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

/* Phone and tablet */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; gap: 2px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid #26272b; overflow-x: auto; }
  .logo { margin: 0 8px 0 0; padding: 0 4px; }
  .logo .brand { display: none; }
  .nav-btn { padding: 8px 10px; white-space: nowrap; }
  .nav-btn.profile { margin-top: 0; margin-left: auto; }
  .nav-summary { display: none; }
  .page { padding: 20px 16px; }
  .page.profile { gap: 28px; }
  .title { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .pattern { flex-direction: column; height: auto; min-height: 100%; }
  .editor-head { padding: 14px 16px; gap: 8px; }
  .summary { white-space: normal; }
  .board-wrap { flex: none; padding: 16px; }
  .panel { width: auto; border-left: 0; border-top: 1px solid #26272b; overflow: visible; }
  .overlay { padding: 12px; align-items: flex-start; }
  .picker { grid-template-columns: 1fr; padding: 20px; gap: 20px; max-height: none; }
  .pick-title { white-space: normal; }
  .ob { padding: 24px; }
}
