/* ═══════════════════════════════════════════════
   Arcane Converter — Style System
   ═══════════════════════════════════════════════ */

/* ─── Tokens ─── */
:root,
[data-theme="dark"] {
  --bg:           #0a0a0f;
  --bg-subtle:    #101018;
  --surface:      #18181f;
  --surface-2:    #20202a;
  --border:       #2a2a36;
  --border-hover: #3a3a4a;
  --text:         #eeeeff;
  --text-2:       #b8b8cc;
  --text-3:       #8e8ea8;
  --accent:       #6e8efb;
  --accent-2:     #a777e3;
  --accent-glow:  rgba(110, 142, 251, 0.25);
  --success:      #4ade80;
  --danger:       #f87171;
  --radius:       14px;
  --radius-sm:    10px;
  --radius-xs:    7px;
  --shadow:       0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.2);
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font:         "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "SF Mono", monospace;
}

[data-theme="light"] {
  --bg:           #f4f4f8;
  --bg-subtle:    #eaeaef;
  --surface:      #ffffff;
  --surface-2:    #f0f0f5;
  --border:       #dcdce5;
  --border-hover: #c4c4d0;
  --text:         #1a1a2e;
  --text-2:       #3d3d52;
  --text-3:       #5e5e78;
  --accent:       #5a6cfb;
  --accent-2:     #9b5de5;
  --accent-glow:  rgba(90, 108, 251, 0.18);
  --success:      #16a34a;
  --danger:       #dc2626;
  --shadow:       0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.05);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ─── Layout ─── */
.container {
  max-width: 580px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* ─── Header ─── */
header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--text-2);
  font-size: 0.925rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(20deg) scale(1.08);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─── Filter Pills ─── */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.45rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
}

.filter-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ─── Mode Toggle ─── */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 9999px;
  padding: 4px;
  border: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* ─── Gold Info ─── */
.gold-info {
  display: none;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  justify-content: center;
}

.gold-info-detail {
  font-size: 0.8125rem;
  color: var(--text-2);
  background: var(--bg-subtle);
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 500;
}

/* ─── Gold Warning ─── */
.gold-warning {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  animation: shake 0.4s ease;
}

[data-theme="light"] .gold-warning {
  background: rgba(220, 38, 38, 0.06);
}

/* ─── Cross-Category Notice ─── */
.cross-notice {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.6;
  text-align: left;
  animation: fade-in 0.3s ease;
  white-space: pre-line;
}

.cross-notice-info {
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: var(--accent);
}

.cross-notice-warning {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--warning, #fbbf24);
}

[data-theme="light"] .cross-notice-info {
  background: rgba(37, 99, 235, 0.06);
}

[data-theme="light"] .cross-notice-warning {
  background: rgba(245, 158, 11, 0.06);
}

/* ─── Price Status ─── */
.price-status {
  display: none;
  margin-top: 0.65rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  transition: all var(--transition);
  white-space: nowrap;
}

.price-live {
  color: var(--success);
  background: rgba(74, 222, 128, 0.08);
}

.price-cached {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.price-offline {
  color: var(--text-3);
  background: var(--bg-subtle);
}

.price-custom {
  color: var(--accent-2);
  background: rgba(167, 119, 227, 0.08);
}

.price-loading {
  color: var(--text-3);
  background: var(--bg-subtle);
  animation: pulse-subtle 1.5s ease infinite;
}

@keyframes pulse-subtle {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* ─── Custom Price Override ─── */
.custom-price {
  margin-top: 0.5rem;
  text-align: center;
}

.custom-price-row {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.custom-price-input {
  width: 130px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  text-align: right;
  transition: all var(--transition);
}

.custom-price-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.custom-price-input::placeholder {
  color: var(--text-3);
  font-family: var(--font);
  text-align: center;
}

.custom-price-btn,
.custom-price-reset {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.custom-price-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.custom-price-reset:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.custom-price-hint {
  font-size: 0.75rem;
  color: var(--text-2);
  margin-top: 0.3rem;
}

.custom-price.active .custom-price-input {
  border-color: var(--accent);
  background: rgba(110, 142, 251, 0.06);
}

/* ─── Converter Card ─── */
.converter {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}

/* ─── Input Groups ─── */
.input-group {
  margin-bottom: 1.25rem;
  position: relative;
}

.input-group label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ─── Number Input ─── */
input[type="number"],
.search-input {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.875rem 1rem;
  font-size: 1.125rem;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

#inputValue {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

input[type="number"]:focus,
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Search input */
.search-input {
  font-size: 0.875rem;
  padding: 0.6rem 0.875rem;
  margin-bottom: 0.5rem;
  background: var(--bg);
}

.search-input::placeholder {
  color: var(--text-3);
}

/* ─── Select ─── */
select {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239898a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select optgroup {
  font-weight: 600;
  color: var(--text-2);
  font-style: normal;
}

select option {
  padding: 0.5rem;
}

/* ─── Info text ─── */
.info {
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-top: 0.35rem;
  min-height: 1.2em;
  line-height: 1.5;
  transition: color var(--transition);
}

.info-id {
  display: block;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.info-en {
  display: block;
  color: var(--text-3);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 0.15rem;
  line-height: 1.35;
}

/* ─── Swap Button ─── */
.swap {
  display: flex;
  justify-content: center;
  margin: -0.25rem 0 1rem;
}

.swap button {
  width: 48px;
  height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

.swap button:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.swap-spin {
  animation: spin-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes spin-bounce {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ─── Result ─── */
.result {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.25rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  min-height: 72px;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: border-color var(--transition);
}

.result:focus-within,
.result:has(.result-flash) {
  border-color: var(--accent);
}

#output {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  word-break: break-all;
  transition: opacity 0.15s;
  letter-spacing: -0.02em;
}

.result-flash {
  animation: flash-in 0.35s ease;
}

@keyframes flash-in {
  0%   { opacity: 0.3; transform: translateY(4px); }
  100% { opacity: 1;  transform: translateY(0); }
}

/* ─── Controls row ───
.controls {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
*/
.controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.precision-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.precision-control label {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input.precision {
  width: 64px;
  padding: 0.45rem 0.5rem;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  text-align: center;
  transition: all var(--transition);
}

input.precision:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-custom {
  padding: 0.5rem 1.1rem;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  transition: all var(--transition);
  margin-left: auto;
}

.add-custom:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ═══ Modal ═══ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal.open {
  display: flex;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h2 {
  margin-bottom: 1.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-bottom: 0.35rem;
  display: block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: var(--font);
  transition: all var(--transition);
}

.form-group textarea {
  min-height: 72px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-buttons button {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}

.cancel-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.confirm-btn {
  background: var(--accent);
  color: #fff;
  border: none;
}

.confirm-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ═══ Shake animation ═══ */
.shake {
  animation: shake 0.4s ease;
  border-color: var(--danger) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ═══ Responsive ═══ */
@media (max-width: 480px) {
  .container {
    padding: 1.25rem 1rem 2rem;
  }

  h1 {
    font-size: 1.875rem;
  }

  #inputValue {
    font-size: 1.625rem;
    padding: 0.75rem;
  }

  #output {
    font-size: 1.5rem;
  }

  .converter {
    padding: 1.25rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .add-custom {
    margin-left: 0;
    text-align: center;
  }
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ═══ Number input arrows (hide for cleaner look) ═══ */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.3;
}

/* ═══ Select optgroup styling ═══ */
select optgroup {
  font-size: 0.75rem;
  padding: 0.25rem 0;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════ */

.footer {
  margin-top: 3rem;
  text-align: center;
  padding: 0 1rem 1.5rem;
}

.footer-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.footer-inner:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.footer-icon {
  font-size: 1rem;
  display: inline-block;
  animation: footerBolt 2.5s ease-in-out infinite;
}

.footer-icon:last-child {
  animation-delay: 0.3s;
}

@keyframes footerBolt {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
  25%      { transform: translateY(-3px) rotate(-8deg); opacity: 1; }
  75%      { transform: translateY(-1px) rotate(4deg); opacity: 0.9; }
}

.footer-text {
  font-size: 0.8125rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}


