:root {
  --ink: #1c1612;
  --muted: #6b5d52;
  --wood-dark: #3d2a1c;
  --cream: #f6efe6;
  --paper: #fffbf6;
  --line: rgba(61, 42, 28, 0.12);
  --danger: #9b2c2c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  letter-spacing: -0.02em;
}

[hidden] {
  display: none !important;
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.card-form,
.item {
  background: var(--paper);
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: 0 12px 32px rgba(28, 22, 18, 0.08);
}

.login-card {
  width: min(100%, 420px);
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: #8b5e3c;
}

h1,
h2 {
  margin: 8px 0 12px;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-weight: 700;
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 96px;
  line-height: 1.7;
}

.editor-head {
  margin: 16px 0 8px;
}

.editor-head strong {
  display: block;
  font-size: 0.92rem;
}

.row.wrap {
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.phone-stage {
  width: min(100%, 390px);
  margin: 12px auto 16px;
  padding: 0 16px;
}

.phone-frame {
  width: 100%;
  margin: 0;
  background: #ececec;
  border-radius: 14px;
  overflow: hidden;
}

.title-as-page {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #e4e4e4;
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  padding: 16px 18px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  min-height: 3.4em;
}

.title-as-page:focus {
  outline: 2px solid rgba(61, 42, 28, 0.25);
  outline-offset: -2px;
}

.notice-panel-edit {
  background: #fffbf6;
  padding: 8px 16px 18px;
}

.notice-blocks {
  display: grid;
  gap: 0;
  margin: 0;
}

.edit-block {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.block-text {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0 auto 12px;
  padding: 4px 2px;
  border: 1px dashed transparent;
  border-radius: 8px;
  background: transparent;
  text-align: center;
  white-space: pre-wrap;
  overflow: hidden;
  color: #3a312b;
  line-height: 1.8;
  font-size: 0.98rem;
  font-family: inherit;
  letter-spacing: -0.02em;
  outline: none;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.block-text:focus {
  border-color: rgba(61, 42, 28, 0.28);
  background: #fff;
}

.block-text:empty:before {
  content: attr(data-placeholder);
  color: #9a8b7e;
}

.block-text b,
.block-text strong {
  font-weight: 800;
}

.block-text i,
.block-text em {
  font-style: italic;
}

.block-text u {
  text-underline-offset: 2px;
}

.block-text mark {
  background: #fff3a3;
  color: inherit;
  padding: 0 1px;
  border-radius: 3px;
}

.format-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 8px;
  background: var(--paper);
  border-radius: 16px;
  border: 1px solid var(--line);
}

.format-bar > button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.format-bar > button:active {
  background: var(--cream);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.swatch {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(61, 42, 28, 0.18);
  cursor: pointer;
}

.img-block {
  display: grid;
  justify-items: center;
  gap: 0;
  background: transparent;
}

.img-block img {
  display: block;
  width: auto;
  max-width: 148px;
  max-height: 148px;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  margin: 8px auto 16px;
  background: #efe4d6;
}

.block-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin: -8px 0 12px;
  justify-content: center;
}

.block-tools .mini {
  min-height: 32px;
  padding: 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.item-preview {
  max-height: 7.5rem;
  overflow: hidden;
  mask-image: linear-gradient(#000 70%, transparent);
}

.item-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 8px 0 10px;
}

.item-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #efe4d6;
  flex: 0 0 auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check input {
  width: auto;
}

.btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--wood-dark);
  color: #f8efe6;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.row {
  display: flex;
  gap: 8px;
}

.error {
  color: var(--danger);
}

.ok {
  color: #2f6b3a;
  font-weight: 700;
}

.back,
.text-btn,
.mini {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  color: var(--wood-dark);
  text-decoration: none;
}

.admin-bar strong {
  flex: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 8px 0;
  overflow-x: auto;
}

.tab {
  flex: 1;
  min-width: 72px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
}

.tab.is-on {
  background: var(--wood-dark);
  color: #f8efe6;
}

.panel {
  padding: 8px 16px 40px;
}

.stack {
  display: grid;
  gap: 10px;
}

.item h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  white-space: pre-line;
}

.item p {
  margin: 0 0 10px;
  color: #3a312b;
  white-space: pre-wrap;
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 10px;
  background: #d9c3ac;
}

.item .row {
  justify-content: flex-end;
}

.mini.danger {
  color: var(--danger);
  font-weight: 700;
}

.stats-device {
  background: var(--paper);
  border-radius: 18px;
  padding: 14px 16px;
  margin: 12px 0;
  box-shadow: 0 8px 24px rgba(28, 22, 18, 0.06);
}

.stats-device p {
  margin: 0 0 10px;
}

.stats-device .btn {
  width: 100%;
}

.stats-nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
}

.stats-num {
  background: var(--paper);
  border-radius: 18px;
  padding: 14px 8px 16px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(28, 22, 18, 0.06);
}

.stats-num span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stats-num b {
  display: block;
  margin-top: 6px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stats-card {
  background: var(--paper);
  border-radius: 18px;
  padding: 16px;
  margin: 0 0 12px;
  box-shadow: 0 8px 24px rgba(28, 22, 18, 0.06);
}

.stats-card > strong {
  display: block;
  margin-bottom: 8px;
}

.stats-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.stats-card-head strong {
  margin: 0;
}

.stats-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  min-height: 92px;
}

.stats-day {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.stats-day i {
  display: block;
  width: 100%;
  max-width: 22px;
  border-radius: 8px 8px 3px 3px;
  background: #c9a078;
  min-height: 4px;
}

.stats-day b {
  font-size: 0.75rem;
  font-weight: 800;
}

.stats-day span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.stats-paths {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.path-row {
  display: grid;
  grid-template-columns: 7.2rem 1fr auto;
  gap: 8px;
  align-items: center;
}

.path-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.path-bar {
  height: 8px;
  border-radius: 999px;
  background: #efe4d6;
  overflow: hidden;
}

.path-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--wood-dark);
}

.path-meta {
  min-width: 4.4rem;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.stats-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.works-admin-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

.works-admin-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #efe4d6;
  aspect-ratio: 1;
}

.works-admin-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.works-admin-item .mini {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: rgba(255, 251, 246, 0.94);
}

.file-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 64px;
}

.file-btn.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.works-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 759px) {
  input,
  textarea,
  select,
  .title-as-page,
  .block-text {
    font-size: 16px;
  }

  .phone-stage {
    padding: 0 4px;
  }

  .block-tools {
    gap: 8px;
    margin: 0 0 16px;
  }

  .block-tools .mini,
  .mini {
    min-height: 44px;
    padding: 0 10px;
  }

  .format-bar > button,
  .swatch {
    min-height: 44px;
  }

  .swatch {
    width: 32px;
    min-width: 32px;
  }
}
