@charset "UTF-8";
:root {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  line-height: 1.5;
  color: #111;
  background: #f2f2f7;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* iOS 淺色主題 - 主要介面 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(248, 248, 250, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e5e5ea;
}

.app-title {
  font-size: 16px;
  font-weight: 600;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  color: #111;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.icon-button i {
  font-size: 18px;
  line-height: 1;
  display: block;
}

/* iOS 淺色主題 - 側邊選單 */
.app-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  padding: 16px;
  background: #fff;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 30;
}

.app-menu.is-open {
  transform: translateX(0);
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.menu-title {
  font-size: 16px;
  font-weight: 600;
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-link {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  color: #111;
  text-decoration: none;
  background: #f7f7fb;
}

.menu-link:hover {
  background: #ededf4;
}

.menu-link.is-active {
  background: #111;
  color: #fff;
}

/* iOS 淺色主題 - 遮罩層與內容 */
.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 25;
}

.menu-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-main {
  padding: 20px 16px;
}

/* 共用按鈕與操作列 */
.ui-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ui-btn {
  border: 0;
  border-radius: 14px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.ui-btn--primary {
  background: #111;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

.ui-btn--secondary {
  background: #fff;
  color: #111;
  border: 1px solid #e3e3e8;
}

.ui-btn--ghost {
  background: transparent;
  color: #111;
  border: 1px solid #d8d8de;
}

.ui-btn:active {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

/* 共用標籤 */
.ui-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ui-tag {
  border: 0;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  background: #f2f2f7;
  font-size: 12px;
  color: #4a4a4f;
}

/* Toast 模組 */
.ui-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 50;
}

.ui-toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

/* Loading 模組 */
.ui-loading {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 55;
  pointer-events: auto;
  background: transparent;
  cursor: wait;
}

.ui-loading.is-show {
  display: flex;
}

.ui-loading-card {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #d5d5db;
  border-top-color: #111;
  animation: ui-spin 0.8s linear infinite;
}

@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}
/* 彈出視窗模組 */
.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

/* medium-zoom 置頂顯示 */
.medium-zoom-overlay,
.medium-zoom-image--opened {
  z-index: 80;
}

.ui-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.ui-modal-card {
  position: relative;
  background: #fff;
  max-width: 520px;
  margin: 0 16px;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  z-index: 1;
  max-height: 80vh;
  overflow-y: auto;
}

.ui-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui-modal-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.ui-modal-close {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.ui-modal-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #6b6b73;
}

.ui-modal-section {
  margin-top: 14px;
}

.ui-modal-label {
  font-size: 12px;
  color: #6b6b73;
  margin-bottom: 6px;
}

.ui-modal-list {
  margin: 0;
  padding-left: 18px;
  color: #2f2f33;
}

.ui-modal-actions {
  margin-top: 16px;
}

/* 共用顏色選擇 */
.ui-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ui-color-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.ui-color-chip {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid #bfc2c9;
  background: #f2f2f7;
  position: relative;
  cursor: pointer;
}

.ui-color-chip .ui-color-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1f1f25;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.ui-color-add {
  border: 1px solid #e3e3e8;
  background: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
}

/* 共用歷史卡片 */
.ui-history .ui-history-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
.ui-history .ui-history-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 12px;
  cursor: pointer;
}
.ui-history .ui-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.ui-history .ui-history-fav {
  border: 0;
  background: transparent;
  font-size: 16px;
  color: #8a8a92;
  cursor: pointer;
}
.ui-history .ui-history-fav.is-active {
  color: #f5a623;
}
.ui-history .ui-history-time {
  font-size: 12px;
  color: #6b6b73;
}
.ui-history .ui-history-body {
  display: grid;
  gap: 12px;
}
.ui-history .ui-history-label {
  font-size: 12px;
  color: #6b6b73;
  min-width: 36px;
}
.ui-history .ui-history-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ui-history .ui-history-value {
  color: #2f2f33;
  font-size: 13px;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.6;
  word-break: break-word;
}
.ui-history .ui-history-output {
  flex-direction: column;
  gap: 4px;
}
.ui-history .ui-history-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ui-history .ui-history-item--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.ui-history .ui-history-item--stack .ui-history-item-value {
  display: block;
}
.ui-history .ui-history-item-label {
  font-weight: 700;
  color: #3f5a92;
  white-space: nowrap;
}
.ui-history .ui-history-item-value {
  color: #2f2f33;
}
.ui-history .ui-history-item--media {
  gap: 8px;
}
.ui-history .ui-history-thumb {
  width: 72px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #e0e0e6;
}
.ui-history .ui-history-thumb--output {
  width: 300px;
  height: 300px;
}
.ui-history .ui-history-thumb--ref {
  width: 88px;
  height: 66px;
}
.ui-history .ui-history-thumb--modal {
  width: 100%;
  height: auto;
}
.ui-history .ui-history-color {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #bfc2c9;
}
.ui-history .ui-history-item--line {
  width: 100%;
}
.ui-history .ui-history-item--block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.ui-history .ui-history-ref-note {
  font-size: 12px;
  color: #6b6b73;
}
.ui-history .ui-history-modal-block {
  display: grid;
  gap: 6px;
}
.ui-history .ui-history-modal-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ui-history .ui-history-ref-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.ui-history-card.is-favorite {
  border: 1px solid rgba(245, 166, 35, 0.35);
}

/* 歷史共用：色塊（列表 / 彈窗共用） */
.ui-history-color {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #bfc2c9;
}

/* 彈窗內的歷史排版（不依賴 .ui-history） */
.ui-modal .ui-history-modal-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ui-modal .ui-history-thumb--modal {
  width: 100%;
  height: auto;
}

.ui-modal .ui-history-ref-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.ui-modal .ui-history-ref-note {
  font-size: 12px;
  color: #6b6b73;
}

.ui-modal .ui-history-item-label + .ui-history-color {
  margin-left: 6px;
}

.ui-modal .ui-history-color + .ui-history-item-value {
  margin-left: 6px;
}

/* 基本資料頁面 */
.bp-container {
  max-width: 960px;
  margin: 0 auto;
}

.bp-section {
  margin-top: 28px;
}

.bp-section-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}
.bp-section-head p {
  margin: 0;
  color: #6b6b73;
}

.bp-form-grid {
  margin-top: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.bp-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}
.bp-field span {
  font-size: 13px;
  color: #6b6b73;
}
.bp-field input,
.bp-field textarea {
  border: 1px solid #e3e3e8;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafafa;
  resize: vertical;
}

.bp-required {
  color: #d64045;
  font-style: normal;
  font-weight: 700;
  margin-left: 4px;
}

.bp-field-span {
  grid-column: 1/-1;
}

.bp-color-hint {
  font-size: 12px;
  color: #9a9aa2;
}

@media (min-width: 860px) {
  .bp-container {
    max-width: 920px;
  }
}