/* ============================================================
 *  base.css —— 设计变量 / 重置 / 通用组件
 *  风格：海拉鲁夜色 · 神庙符文 · 金色古卷
 * ============================================================ */

:root {
  /* ---- 底层色 ---- */
  --ink-900: #05090a;
  --ink-800: #080f10;
  --ink-700: #0c1618;
  --ink-600: #101f22;
  --ink-500: #16292d;

  /* ---- 主色 ---- */
  --gold-1: #f7e2a8;
  --gold-2: #d9b45b;
  --gold-3: #a8842f;
  --gold-4: #6b5218;

  --sheikah-1: #a8fff0;
  --sheikah-2: #55e6d0;
  --sheikah-3: #1c9c8d;
  --sheikah-glow: rgba(85, 230, 208, .42);

  --parchment: #ece0c6;
  --muted: #90a3a0;
  --muted-dim: #68807d;

  /* ---- 稀有度 ---- */
  --r-common: #7fd8a0;
  --r-rare: #5aa9ff;
  --r-epic: #b483ff;
  --r-legendary: #ffb648;
  --r-mythic: #ff6fae;

  --danger: #e2695f;
  --ok: #58d68d;

  /* ---- 排版 ---- */
  --font-display: "Cinzel", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: "PingFang SC", "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  /* ---- 形状 ---- */
  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;
  --line: rgba(217, 180, 91, .28);
  --line-soft: rgba(85, 230, 208, .14);

  --shadow-deep: 0 24px 60px rgba(0, 0, 0, .65);
  --shadow-gold: 0 0 0 1px rgba(217, 180, 91, .35), 0 10px 30px rgba(0, 0, 0, .5);

  /* 神庙电路纹样 */
  --sheikah-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%2355e6d0' stroke-opacity='0.10' stroke-width='1'%3E%3Cpath d='M0 45h45l22-22h58'/%3E%3Cpath d='M180 135h-45l-22 22H55'/%3E%3Cpath d='M45 180v-45l-22-22V55'/%3E%3Cpath d='M135 0v45l22 22v58'/%3E%3Ccircle cx='125' cy='23' r='2.6'/%3E%3Ccircle cx='55' cy='157' r='2.6'/%3E%3Ccircle cx='23' cy='55' r='2.6'/%3E%3Ccircle cx='157' cy='125' r='2.6'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--parchment);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::selection { background: rgba(217, 180, 91, .35); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
::-webkit-scrollbar-thumb { background: rgba(217, 180, 91, .3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(217, 180, 91, .5); }

/* ==========================================================
 *  伴手礼分类配色（复用 --rar 变量，卡片光晕随之变化）
 * ========================================================== */
.c-home      { --rar: #d9b45b; }
.c-appliance { --rar: #5aa9ff; }
.c-plant     { --rar: #7fd8a0; }
.c-food      { --rar: #ffa45c; }
.c-other     { --rar: #b483ff; }
/* 兼容旧类名 */
.r-common    { --rar: #7fd8a0; }
.r-rare      { --rar: #5aa9ff; }
.r-epic      { --rar: #b483ff; }
.r-legendary { --rar: #ffb648; }
.r-mythic    { --rar: #ff6fae; }

/* ==========================================================
 *  按钮
 * ========================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(217, 180, 91, .14), rgba(217, 180, 91, .04));
  color: var(--gold-1);
  font-size: 14px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: .22s ease;
  white-space: nowrap;
}
.btn:hover {
  border-color: rgba(217, 180, 91, .65);
  background: linear-gradient(180deg, rgba(217, 180, 91, .26), rgba(217, 180, 91, .08));
  box-shadow: 0 0 18px rgba(217, 180, 91, .22);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .14);
  color: var(--muted);
  letter-spacing: .04em;
}
.btn-ghost:hover {
  color: var(--parchment);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: none;
}
.btn-danger { color: #ffb3ad; border-color: rgba(226, 105, 95, .45); }
.btn-danger:hover {
  border-color: rgba(226, 105, 95, .8);
  background: rgba(226, 105, 95, .14);
  box-shadow: 0 0 18px rgba(226, 105, 95, .2);
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ==========================================================
 *  卡片 / 面板
 * ========================================================== */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(16, 31, 34, .92), rgba(8, 15, 16, .96));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-deep);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--sheikah-pattern);
  opacity: .5;
  pointer-events: none;
}
.corner {
  position: absolute;
  width: 16px; height: 16px;
  border: 1px solid var(--gold-2);
  opacity: .55;
  pointer-events: none;
}
.corner.tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.corner.br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* ==========================================================
 *  表单
 * ========================================================== */
.field { display: block; margin-bottom: 16px; }
.field > .label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.field .hint { margin-top: 6px; font-size: 12px; color: var(--muted-dim); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-m);
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(3, 8, 9, .7);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: .2s;
}
.input::placeholder, .textarea::placeholder { color: #4d6360; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(85, 230, 208, .5);
  box-shadow: 0 0 0 3px rgba(85, 230, 208, .1);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-2) 50%),
                    linear-gradient(135deg, var(--gold-2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.select option { background: var(--ink-700); color: var(--parchment); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--parchment); }
.switch input { display: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .12);
  position: relative; transition: .22s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: .22s;
}
.switch input:checked + .track { background: rgba(85, 230, 208, .22); border-color: rgba(85, 230, 208, .5); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--sheikah-2); box-shadow: 0 0 12px var(--sheikah-glow); }

/* ==========================================================
 *  Toast
 * ========================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(8, 18, 19, .96);
  border: 1px solid var(--line);
  color: var(--gold-1);
  font-size: 14px;
  letter-spacing: .04em;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: .3s cubic-bezier(.2, .8, .3, 1);
  z-index: 999;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(226, 105, 95, .6); color: #ffc2bc; }

/* ==========================================================
 *  弹窗
 * ========================================================== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 7, .78);
  backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-box {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 26px;
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, #0e1c1f, #07100f);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  transform: translateY(14px) scale(.985);
  transition: .28s cubic-bezier(.2, .8, .3, 1);
}
.modal.show .modal-box { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { font-family: var(--font-display); font-size: 19px; color: var(--gold-1); letter-spacing: .06em; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .12);
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  transition: .2s;
}
.modal-close:hover { color: var(--parchment); border-color: rgba(255, 255, 255, .3); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ==========================================================
 *  徽标 / 杂项
 * ========================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; letter-spacing: .12em;
  border: 1px solid color-mix(in srgb, var(--rar, var(--gold-2)) 55%, transparent);
  color: var(--rar, var(--gold-1));
  background: color-mix(in srgb, var(--rar, var(--gold-2)) 12%, transparent);
  white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-s);
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
