@font-face {
  font-family: "Pickllle";
  src: url("/assets/fonts/Pickllle.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Site palette — available to applet-hosted Prism/Rouge */
  --blue: #43A0BD;
  --aqua: #6BC4C4;
  --green: #8DB848;
  --gold: #D19A3F;
  --coral: #DC8B6C;
  --indigo: #6659C7;
  --violet: #9B5FBF;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  color: inherit;
  scrollbar-gutter: stable;
}

img,
svg,
canvas,
video,
iframe {
  max-width: 100%;
  display: block;
}

.applet {
  --bg: transparent;

  --panel: rgba(255, 255, 255, 0.72);
  --panel-soft: rgba(255, 255, 255, 0.52);

  --border: rgba(17, 17, 17, 0.14);
  --border-soft: rgba(17, 17, 17, 0.10);

  --text: rgba(17, 17, 17, 0.92);
  --muted: rgba(17, 17, 17, 0.62);

  --accent: rgba(45, 92, 140, 1);

  --radius: 14px;
  --radius-sm: 9px;

  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  background: var(--bg);
  color: var(--text);
  padding: 0.75rem;

  /* site palette */
  --blue: #43A0BD;
  --aqua: #6BC4C4;
  --green: #8DB848;
  --gold: #D19A3F;
  --coral: #DC8B6C;
  --indigo: #6659C7;
  --violet: #9B5FBF;

  /* code tokens */
  --code-text: rgba(0, 0, 0, 0.88);
  --code-muted: rgba(0, 0, 0, 0.55);
  --code-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.applet-wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  min-width: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}



/* -----------------------------
   Rows
   ----------------------------- */

.row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}

.row.wrap {
  flex-wrap: wrap;
}

.spacer {
  margin-left: auto;
}

/* -----------------------------
   Panels
   ----------------------------- */

.panel {
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.58));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
  min-width: 0;
}

.panel--padded {
  padding: 0.55rem 0.7rem;
}

/* -----------------------------
   Typography helpers
   ----------------------------- */

.label {
  font-family: var(--ui);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 0 0 auto;
}

.mono {
  font-family: var(--mono);
  font-weight: 900;
  letter-spacing: 0.02em;
}

/* -----------------------------
   Audio header (title + sr/status)
   ----------------------------- */

.audio-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.audio-title {
  min-width: 0;
}

.audio-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.audio-button {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text);
  white-space: nowrap;
  outline: none;
}

.audio-button:hover {
  background: rgba(255, 255, 255, 0.75);
}

.audio-button:focus-visible {
  border-color: rgba(45, 92, 140, 0.45);
  box-shadow: 0 0 0 2px rgba(45, 92, 140, 0.18);
}

.audio-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.audio-meta {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.audio-sr,
.audio-status {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.audio-status {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

/* -----------------------------
   Inputs
   ----------------------------- */

.input {
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  width: 100%;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}

.row .input {
  width: auto;
  flex: 1 1 220px;
}

.input:focus {
  border-color: rgba(45, 92, 140, 0.45);
  box-shadow: 0 0 0 2px rgba(45, 92, 140, 0.18);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* -----------------------------
   Select dropdowns
   ----------------------------- */

.audio-select,
select.audio-select {
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23111111' stroke-opacity='0.5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 2rem;
}

.audio-select:hover {
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--border);
}

.audio-select:focus {
  border-color: rgba(45, 92, 140, 0.45);
  box-shadow: 0 0 0 2px rgba(45, 92, 140, 0.18);
}

.audio-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -----------------------------
   Checkboxes
   ----------------------------- */

input[type="checkbox"]:disabled+.label {
  opacity: 0.4;
  cursor: not-allowed;
}

/* -----------------------------
    Ranges
   ----------------------------- */

.range {
  width: 100%;
  margin: 0;
  min-width: 0;
  accent-color: var(--accent);
}

.row .range {
  width: auto;
  flex: 1 1 auto;
  min-width: 200px;
}

.range.compact {
  width: auto;
  flex: 0 0 clamp(220px, 32vw, 320px);
  min-width: 200px;
}

@media (max-width: 420px) {
  .range.compact {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* -----------------------------
   Output readouts
   ----------------------------- */

.audio-val {
  font-family: var(--mono);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}

/* -----------------------------
   Buttons
   ----------------------------- */

.btn {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;

  font-family: var(--ui);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--text);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(45, 92, 140, 0.18);
}

.btn.primary {
  background: linear-gradient(180deg,
      rgba(45, 92, 140, 0.18),
      rgba(45, 92, 140, 0.10));
  border-color: rgba(45, 92, 140, 0.38);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -----------------------------
   Surfaces
   ----------------------------- */

.surface {
  padding: 0.6rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.58));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* -----------------------------
   Readout grid
   ----------------------------- */

.readout {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 420px) {
  .readout {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .readout-value {
    font-size: 0.85rem;
  }
}

.readout-item {
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.58));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.readout-label {
  font-family: var(--ui);
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--muted);
}

.readout-value {
  font-family: var(--mono);
  font-weight: 900;
  font-size: 0.95rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

/* -----------------------------
   Mobile
   ----------------------------- */

@media (max-width: 420px) {
  .applet {
    padding: 0.5rem;
  }

  .row {
    flex-wrap: wrap;
  }

  .row .range {
    flex: 1 1 100%;
    min-width: 0;
  }

  .row .input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .audio-head {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .audio-title {
    flex: 1 1 100%;
  }

  .audio-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .audio-sr {
    font-size: 0.8rem;
  }
}