@import url("./theme-tokens.css");

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-1);
}

body {
  color: var(--text-strong);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--bg-1);
}

body::before {
  content: none;
}

h1,
h2,
legend,
.song-row__title,
.preset-button,
.generate-button,
#new-seed,
#copy-url,
#open-url,
.tool-panel__status,
.selector-shell__header,
.title-strip__label {
  font-family: "Press Start 2P", "Space Mono", monospace;
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}

.crumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 2px solid rgba(240, 236, 255, 0.62);
  border-radius: 6px;
  padding: 0.36rem 0.58rem;
  background: var(--panel-bg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.62);
}

.crumbs,
.crumbs a {
  color: var(--text-strong);
  text-decoration: none;
  font-family: "Press Start 2P", "Space Mono", monospace;
  font-size: 0.55rem;
  line-height: 1.45;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.crumbs a {
  border-bottom: 0;
}

.crumbs a:hover {
  color: #ffffff;
}

.title-strip {
  margin-top: 0.7rem;
  margin-bottom: 0.62rem;
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  background: rgba(45, 37, 79, 0.98);
  color: var(--text-strong);
  border: 2px solid rgba(240, 236, 255, 0.7);
  border-radius: 5px;
  padding: 0.34rem 0.58rem;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.52);
}

.title-strip__label {
  font-size: 0.48rem;
  letter-spacing: 0.06em;
}

.title-strip__hint {
  font-size: 0.72rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3.2vw, 2.15rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-strong);
  text-shadow: 0 0 20px rgba(214, 201, 255, 0.3);
}

.subtitle {
  margin: 0.52rem 0 0;
  max-width: 70ch;
  border-left: 3px solid rgba(240, 236, 255, 0.6);
  padding-left: 0.58rem;
  color: var(--text-muted);
}

.ddr-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.selector-column {
  display: grid;
  gap: 0.9rem;
}

.selector-shell,
.panel-column {
  position: relative;
  border: 3px solid rgba(240, 236, 255, 0.62);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.62);
}

.selector-shell::after,
.panel-column::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(224, 218, 246, 0.35);
  border-radius: 4px;
  pointer-events: none;
}

.selector-shell {
  padding: 0.85rem;
}

.selector-shell__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.66rem;
  color: var(--text-strong);
  font-size: 0.53rem;
  letter-spacing: 0.06em;
}

.selector-shell__counter {
  color: var(--accent);
}

.song-list {
  display: grid;
  gap: 0.44rem;
}

.song-row {
  position: relative;
  display: grid;
  gap: 0.24rem;
  width: 100%;
  text-align: left;
  border: 2px solid rgba(214, 201, 255, 0.62);
  border-radius: 4px;
  background: rgba(29, 23, 54, 0.95);
  color: var(--text-strong);
  padding: 0.62rem 0.72rem 0.6rem 2.1rem;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.song-row::before {
  content: "";
  position: absolute;
  left: 0.62rem;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -6px;
  border-left: 11px solid rgba(240, 236, 255, 0.78);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  opacity: 0;
}

.song-row__title {
  font-size: 0.5rem;
  line-height: 1.42;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.song-row__meta {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
}

.song-row:hover {
  border-color: rgba(240, 236, 255, 0.82);
}

.song-row.is-selected {
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(52, 43, 88, 0.98);
  box-shadow: none;
}

.song-row.is-selected::before {
  opacity: 1;
}

.song-row.is-selected .song-row__meta {
  color: var(--accent);
}

.selector-shell__footer {
  margin-top: 0.68rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(224, 218, 246, 0.32);
}

.active-readout,
.control-readout {
  margin: 0.28rem 0;
  font-size: 0.82rem;
}

.active-readout {
  color: var(--text-strong);
  font-weight: 700;
}

.control-readout {
  color: var(--text-dim);
}

.panel-column {
  padding: 0.85rem;
}

.tool-panel {
  display: none;
  border: 2px solid rgba(240, 236, 255, 0.58);
  border-radius: 6px;
  background: rgba(15, 13, 31, 0.9);
  padding: 0.9rem;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.56);
}

.tool-panel.is-active {
  display: block;
}

.tool-panel__header {
  margin-bottom: 0.4rem;
}

.tool-panel__status {
  display: inline-block;
  margin-bottom: 0.36rem;
  border: 1px solid rgba(240, 236, 255, 0.7);
  border-radius: 3px;
  padding: 0.18rem 0.34rem;
  font-size: 0.44rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(31, 24, 57, 0.74);
}

.tool-panel h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tool-panel p,
.tool-panel label,
.tool-panel legend {
  color: var(--text-muted);
}

.url-form {
  display: grid;
  gap: 0.66rem;
}

#target-url,
#seed-input,
#long-url-output {
  width: 100%;
  border: 2px solid rgba(224, 218, 246, 0.38);
  border-radius: 4px;
  background: rgba(10, 9, 22, 0.88);
  color: var(--text-strong);
  padding: 0.56rem 0.7rem;
}

#long-url-output {
  resize: vertical;
}

.length-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.preset-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.preset-button,
#new-seed,
#copy-url,
#open-url,
.generate-button {
  border: 2px solid rgba(240, 236, 255, 0.58);
  border-radius: 4px;
  background: rgba(30, 24, 54, 0.98);
  color: var(--text-strong);
  text-decoration: none;
  padding: 0.44rem 0.62rem;
  box-shadow: none;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.preset-button {
  font-size: 0.72rem;
}

.preset-button.is-selected {
  border-color: rgba(240, 236, 255, 0.74);
  background: rgba(49, 41, 82, 0.98);
  color: var(--accent);
}

.seed-row {
  display: grid;
  gap: 0.45rem;
}

.seed-controls {
  display: flex;
  gap: 0.45rem;
}

.seed-controls #seed-input {
  flex: 1;
}

.checkbox-inline {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.86rem;
}

.generate-button {
  font-size: 0.62rem;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-color: rgba(240, 236, 255, 0.74);
  background: rgba(54, 44, 91, 0.98);
  color: var(--accent);
}

.preset-button:hover,
#new-seed:hover,
#copy-url:hover,
#open-url:hover,
.generate-button:hover {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(58, 47, 96, 0.98);
}

.form-error,
.form-status {
  min-height: 1.25rem;
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.form-error {
  color: var(--danger);
}

.form-status {
  color: var(--ok);
}

.output-actions {
  margin-top: 0.66rem;
  display: flex;
  gap: 0.52rem;
}

.open-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.tool-panel--coming {
  min-height: 240px;
  display: none;
  place-content: center;
}

.tool-panel--coming.is-active {
  display: grid;
}

code {
  font-family: "Space Mono", monospace;
}

@media (max-width: 1100px) {
  .ddr-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding: 0.86rem 0.62rem 1.5rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .title-strip {
    display: grid;
    gap: 0.25rem;
  }

  .song-row {
    padding-left: 1.85rem;
  }

  .song-row__title,
  .tool-panel__status,
  .selector-shell__header,
  .generate-button {
    font-size: 0.46rem;
  }

  .seed-controls {
    flex-direction: column;
  }

  .output-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
