/* ═══════════════════════════════════════════════════════════
   Stardew Valley Save Editor  ·  base.css
   Keyframes, design tokens, reset, layout, header, upload,
   editor shell, tabs, download bar, toast, responsive
   ═══════════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400% center; }
  100% { background-position:  400% center; }
}
@keyframes float-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes icon-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%       { transform: translateY(-8px) rotate(-4deg); }
  70%       { transform: translateY(-4px) rotate(4deg); }
}
@keyframes tab-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes heart-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.7); }
  65%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}
@keyframes ripple-out {
  to { transform: scale(4); opacity: 0; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(110%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(110%); }
}
@keyframes bar-grow {
  from { width: 0 !important; }
}
@keyframes value-pop {
  0%   { transform: scale(1);    color: var(--gold); }
  35%  { transform: scale(1.18); color: #fff; }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1);    color: var(--gold); }
}
@keyframes select-flash {
  0%   { background: rgba(0,0,0,0.3); box-shadow: none; border-color: var(--border2); }
  30%  { background: rgba(50,110,70,0.35); box-shadow: 0 0 0 3px var(--gold-dim); border-color: var(--gold); }
  100% { background: rgba(0,0,0,0.3); box-shadow: none; border-color: var(--border2); }
}
@keyframes glow-border {
  0%, 100% { box-shadow: 0 0 10px rgba(232,200,74,0.2); }
  50%       { box-shadow: 0 0 28px rgba(232,200,74,0.55); }
}

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --bg:           #0c0e18;
  --glass:        rgba(16, 13, 7, 0.65);
  --glass2:       rgba(22, 18, 10, 0.55);
  --parchment:    #f0ddb8;
  --parchment2:   #c8a870;
  --border:       rgba(139, 105, 20, 0.6);
  --border2:      rgba(72, 54, 10, 0.55);
  --border-h:     rgba(232, 200, 74, 0.75);
  --green:        #3c7a50;
  --green-h:      #2c6040;
  --green-glow:   rgba(60, 122, 80, 0.45);
  --gold:         #e8c84a;
  --gold-dim:     rgba(232, 200, 74, 0.12);
  --gold-glow:    rgba(232, 200, 74, 0.38);
  --gold-h:       #d4b43a;
  --red:          #b42828;
  --red-h:        #8e1e1e;
  --blue:         #2470a8;
  --blue-h:       #1a5888;
  --text-dark:    #1e1005;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --blur:         blur(16px) saturate(1.4);
  --radius:       10px;
  --radius-sm:    6px;
}

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

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--bg);
  color: var(--parchment);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background canvas ──────────────────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Page wrapper ────────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 52px 16px 32px;
  animation: float-up 0.9s var(--ease) both;
}
header h1 {
  font-size: clamp(13px, 3.2vw, 24px);
  letter-spacing: 3px;
  line-height: 1.8;
  background: linear-gradient(90deg,
    #a07820 0%, #e8c84a 25%, #fff8c0 50%, #e8c84a 75%, #a07820 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s linear infinite;
  filter: drop-shadow(0 0 18px rgba(232,200,74,0.4));
}
header p {
  font-size: 8px;
  color: var(--parchment2);
  margin-top: 14px;
  letter-spacing: 2px;
  opacity: 0;
  animation: fade-in 0.7s 0.5s var(--ease) forwards;
}

/* ── Upload zone ─────────────────────────────────────────────── */
#upload-zone {
  max-width: 560px;
  margin: 0 auto 40px;
  padding: 0 16px;
  animation: float-up 0.9s 0.15s var(--ease) both;
}
.drop-area {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 48px 28px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.35s var(--ease),
    background   0.35s var(--ease),
    box-shadow   0.35s var(--ease);
}
.drop-area:hover,
.drop-area.drag-over {
  border-color: var(--border-h);
  background: rgba(28, 24, 12, 0.8);
  box-shadow:
    0 0 40px var(--gold-glow),
    inset 0 0 60px rgba(232,200,74,0.03);
  animation: glow-border 2s ease-in-out infinite;
}
.drop-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-icon {
  font-size: 54px;
  display: block;
  margin-bottom: 20px;
  animation: icon-float 3.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.55));
}
.drop-text {
  font-size: 9px;
  color: var(--parchment2);
  line-height: 2.4;
}
.drop-text span { color: var(--gold); }
#file-name {
  margin-top: 16px;
  font-size: 8px;
  color: var(--parchment2);
  min-height: 14px;
}

/* ── Editor container ────────────────────────────────────────── */
#editor {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 88px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s var(--ease);
}
#editor.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tab-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 12px 16px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 2px solid var(--border2);
  border-bottom: none;
  color: var(--parchment2);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.25s var(--ease);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 2px;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.3s var(--ease-spring);
}
.tab-btn:hover {
  background: rgba(38, 32, 16, 0.8);
  color: var(--parchment);
  border-color: var(--border);
}
.tab-btn.active {
  background: rgba(22, 18, 8, 0.9);
  color: var(--gold);
  border-color: var(--border);
  text-shadow: 0 0 12px var(--gold-glow);
}
.tab-btn.active::after { transform: scaleX(1); }

/* ── Tab panels ──────────────────────────────────────────────── */
.tab-panel {
  display: none;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 2px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 30px;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.tab-panel.active {
  display: block;
  animation: tab-enter 0.32s var(--ease) both;
}

/* ── Section / sub titles ────────────────────────────────────── */
.section-title {
  font-size: 10px;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 24px;
  letter-spacing: 1.5px;
  text-shadow: 0 0 16px var(--gold-glow);
}
.subsection-title {
  font-size: 7px;
  color: var(--parchment2);
  letter-spacing: 1px;
  margin: 24px 0 12px;
  opacity: 0.8;
}
.subsection-title:first-of-type { margin-top: 0; }

/* ── Download bar ────────────────────────────────────────────── */
#download-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(8, 6, 2, 0.92);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-top: 1.5px solid var(--border);
  padding: 14px 30px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.45s var(--ease);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.6);
}
#download-bar.visible { transform: translateY(0); }
#download-bar .save-label { font-size: 8px; color: var(--parchment2); }

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  top: 22px; right: 22px;
  background: linear-gradient(135deg, #2c6838, #4c9a5c);
  color: #fff;
  font-size: 8px;
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(48,122,72,0.45);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  max-width: 300px;
  line-height: 1.9;
}
#toast.show { animation: toast-in 0.38s var(--ease) forwards; }
#toast.hide { animation: toast-out 0.3s var(--ease) forwards; }

/* ── Hint text ───────────────────────────────────────────────── */
.hint-text {
  font-size: 7px;
  color: #7a6040;
  margin-top: 14px;
  line-height: 2.3;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .skill-row { grid-template-columns: 1fr 90px; }
  .skill-bar-wrap { display: none; }
  .clothes-row { grid-template-columns: 1fr 1fr; }
  .boots-grid { grid-template-columns: 1fr 1fr; }
  .npc-grid { grid-template-columns: 1fr; }
  .v-search { width: 140px; }
}
