@font-face {
  font-family: 'ValikuFont';
  src: url('/assets/font.woff2') format('woff2');
  font-display: swap;
}

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

:root {
  --black: #000000;
  --white: #ffffff;
  --gray50: #7f7f7f;
  --topbar-height: 44px;
  --font: 'ValikuFont', 'Comic Sans MS', 'Comic Sans', cursive;
}

html, body {
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--black);
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  z-index: 1000;
}

#topbar img#site-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

#topbar #site-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.01em;
}

#topbar #tool-name {
  font-size: 13px;
  color: var(--gray50);
  display: none;
}

#topbar #tool-name.visible {
  display: inline;
}

/* ── PAGE CONTENT ───────────────────────────────── */
#page {
  padding-top: var(--topbar-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── TOOL WRAP (injected by tool.js) ────────────── */
.tool-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px 80px;
  gap: 24px;
  width: 100%;
  max-width: 480px;
}

/* ── POPUP SYSTEM ───────────────────────────────── */
#popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

#popup-overlay.open {
  display: flex;
}

.popup-box {
  background: var(--white);
  border: 1px solid #ccc;
  padding: 28px 32px;
  max-width: 440px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.popup-box .popup-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
}

.popup-box .popup-body {
  font-size: 13px;
  color: var(--black);
  line-height: 1.6;
}

.popup-box .popup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── SHARED COMPONENTS ──────────────────────────── */
.v-btn {
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 9px 18px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.v-btn:hover {
  opacity: 0.8;
}

.v-btn.primary {
  background: var(--black);
  color: var(--white);
}

/* home page tool buttons specifically */
.home-tool-btn {
  width: 100%;
}

.v-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.v-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray50);
}

.v-slider {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: #ccc;
  outline: none;
  cursor: pointer;
  border: none;
  padding: 10px 0; /* bigger touch area */
  margin: 0;
  background-clip: content-box;
}

/* webkit (chrome, safari, edge) */
.v-slider::-webkit-slider-runnable-track {
  height: 2px;
  background: #ccc;
  border: none;
}

.v-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--black);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  margin-top: -8px;
}

/* firefox */
.v-slider::-moz-range-track {
  height: 2px;
  background: #ccc;
  border: none;
}

.v-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--black);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.v-slider::-moz-range-progress {
  height: 2px;
  background: var(--black);
}

.v-input {
  background: var(--white);
  border: 1px solid #ccc;
  color: var(--black);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.v-input:focus {
  border-color: #888;
}

.v-select {
  background: var(--white);
  border: 1px solid #ccc;
  color: var(--black);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.v-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #ddd;
}

.v-label {
  font-size: 12px;
  color: var(--black);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.v-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 20px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 3000;
  white-space: nowrap;
}

.v-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── CUSTOM DROPDOWN ────────────────────────────── */
.v-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.v-dropdown-trigger {
  width: 100%;
  background: var(--white);
  border: 1px solid #ccc;
  color: var(--black);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: border-color 0.15s;
}

.v-dropdown-trigger::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
}

.v-dropdown-trigger:hover { border-color: #888; }
.v-dropdown-trigger.open  { border-color: var(--black); }

.v-dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--black);
  border-top: none;
  z-index: 500;
  max-height: 220px;
  overflow-y: auto;
}

.v-dropdown-list.open { display: block; }

.v-dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
}

.v-dropdown-item:hover    { background: #f0f0f0; }
.v-dropdown-item.selected { font-weight: 600; }

/* ── TOOLTIP ────────────────────────────────────── */
.v-tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.v-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 11px;
  padding: 5px 9px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 900;
}

.v-tooltip-wrap:hover .v-tooltip { opacity: 1; }

/* disabled button state */
.v-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── TOPBAR HOME LINK ───────────────────────────── */
#topbar-home {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

/* ── SCROLLBAR ──────────────────────────────────── */
/* webkit (chrome, safari, edge) */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--white);
}

::-webkit-scrollbar-thumb {
  background: var(--black);
}

::-webkit-scrollbar-thumb:hover {
  background: #333;
}

/* firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--black) var(--white);
}

/* ── CONTEXT MENU ───────────────────────────────── */
.v-context-menu {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--black);
  z-index: 4000;
  min-width: 160px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}

.v-context-menu.open {
  opacity: 1;
  pointer-events: all;
}

.v-context-item {
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
}

.v-context-item:hover    { background: #f0f0f0; }
.v-context-item.disabled { opacity: 0.35; cursor: not-allowed; }
.v-context-item.disabled:hover { background: none; }

.v-context-divider {
  border-top: 1px solid #e0e0e0;
  margin: 3px 0;
}

/* ── PROGRESS BAR ───────────────────────────────── */
.v-progress-wrap {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
}

.v-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--black);
  transition: width 0.2s;
}

/* ── TOGGLE ─────────────────────────────────────── */
.v-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.v-toggle-label {
  font-size: 13px;
  font-family: var(--font);
}

.v-toggle {
  width: 36px;
  height: 20px;
  background: #ccc;
  border: none;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  padding: 0;
}

.v-toggle.on { background: var(--black); }

.v-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.15s;
  display: block;
}

.v-toggle.on .v-toggle-knob { transform: translateX(16px); }

/* ── NUMBER INPUT ───────────────────────────────── */
.v-number-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

.v-number-btn {
  width: 32px;
  height: 36px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 16px;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.v-number-btn:hover { opacity: 0.75; }

.v-number-input {
  width: 64px;
  text-align: center;
  border-left: none;
  border-right: none;
  -moz-appearance: textfield;
}

.v-number-input::-webkit-inner-spin-button,
.v-number-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── MODAL ──────────────────────────────────────── */
.v-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.v-modal-overlay.open { opacity: 1; }

.v-modal-box {
  background: var(--white);
  border: 1px solid var(--black);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.v-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.v-modal-title {
  font-size: 14px;
  font-weight: 600;
}

.v-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--black);
  padding: 4px 6px;
  font-family: var(--font);
  opacity: 0.5;
  transition: opacity 0.15s;
}

.v-modal-close:hover { opacity: 1; }

.v-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
}

/* ── FILE DROP ZONE ─────────────────────────────── */
.v-dropzone {
  width: 100%;
  border: 1px dashed #aaa;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}

.v-dropzone:hover,
.v-dropzone.drag-over {
  border-color: var(--black);
  color: var(--black);
}

.v-dropzone.has-file {
  border-style: solid;
  border-color: var(--black);
  color: var(--black);
}

/* ── AUDIO PLAYER ───────────────────────────────── */
.v-audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--black);
}

.v-audio-btn {
  background: none;
  color: var(--white);
  border: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  font-family: var(--font);
  padding: 0;
}

.v-audio-btn:hover { opacity: 0.65; }

.v-audio-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.v-audio-scrubber {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: #444;
  background-clip: content-box;
  padding: 10px 0;
  border: none;
  outline: none;
  cursor: pointer;
}

.v-audio-scrubber::-webkit-slider-runnable-track {
  height: 3px;
  background: #444;
}

.v-audio-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--white);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  margin-top: -5.5px;
}

.v-audio-scrubber::-moz-range-track {
  height: 3px;
  background: #444;
}

.v-audio-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--white);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.v-audio-scrubber::-moz-range-progress {
  height: 3px;
  background: var(--white);
}

.v-audio-progress { display: none; }

.v-audio-time {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

.v-audio-vol {
  width: 64px;
  flex-shrink: 0;
}

/* invert slider colors inside audio player */
.v-audio-player .v-slider {
  background: #444;
  background-clip: content-box;
}
.v-audio-player .v-slider::-webkit-slider-runnable-track { background: #444; }
.v-audio-player .v-slider::-moz-range-track { background: #444; }
.v-audio-player .v-slider::-webkit-slider-thumb { background: var(--white); }
.v-audio-player .v-slider::-moz-range-thumb { background: var(--white); }
.v-audio-player .v-slider::-moz-range-progress { background: var(--white); }
