:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181c20;
  --panel-2: #20262b;
  --line: #343c44;
  --text: #f4f0e8;
  --muted: #aeb7b2;
  --accent: #57c7a2;
  --accent-2: #f3b35a;
  --progress: var(--accent-2);
  --marker-a: #35e0c2;
  --marker-b: #41dfff;
  --danger: #ff6f61;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  --slider-thumb-size: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(87, 199, 162, 0.12), transparent 34%),
    linear-gradient(240deg, rgba(243, 179, 90, 0.11), transparent 32%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242a30;
  color: var(--text);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: var(--accent);
  background: #2a3338;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(87, 199, 162, 0.3);
  outline-offset: 2px;
}

.player-workspace:focus {
  outline: none;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(12px, 2vh, 24px);
  display: flex;
}

.player-workspace {
  width: 100%;
  min-height: calc(100svh - clamp(24px, 4vh, 48px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 1.6vh, 18px);
}

.topbar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.url-stack {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.app-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.08;
}

.url-form {
  min-width: 0;
}

.field-label {
  display: none;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max(52px, calc((100% - 102px) / 8));
  gap: 10px;
  align-items: center;
}

.url-input-shell {
  position: relative;
  min-width: 0;
}

#videoUrl {
  min-width: 0;
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 40px 0 14px;
  background: #15191d;
  color: var(--text);
}

#videoUrl:focus,
#videoUrl:focus-visible {
  outline: none;
  outline-offset: 0;
}

.url-clear-button {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(174, 183, 178, 0.28);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-50%);
}

.url-clear-button.visible {
  display: inline-flex;
}

.url-clear-button:hover {
  background: rgba(174, 183, 178, 0.42);
  color: var(--text);
}

.primary-button,
.secondary-button {
  padding: 0 18px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  min-width: 52px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-color: rgba(87, 199, 162, 0.65);
  background: var(--accent);
  color: #07110e;
}

.primary-button:hover {
  background: #6bd5b2;
  color: #07110e;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.content-grid {
  display: contents;
}

.stage-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 28, 32, 0.92);
  box-shadow: var(--shadow);
}

.stage-panel {
  --media-width: min(100%, calc(max(240px, 100svh - 292px) * 16 / 9));
  grid-column: 1;
  grid-row: 2;
  padding: clamp(10px, 1.6vh, 16px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 14px);
}

.video-frame {
  position: relative;
  width: var(--media-width);
  max-height: calc(100svh - 292px);
  align-self: center;
  aspect-ratio: 16 / 9;
  margin-bottom: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #060708;
}

#player,
#player iframe,
.local-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.local-player {
  display: none;
  background: #060708;
  object-fit: contain;
}

.local-player.visible {
  display: block;
}

#player.hidden {
  display: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(87, 199, 162, 0.12), transparent),
    #080a0b;
}

.empty-state strong {
  color: var(--text);
  font-size: clamp(1.2rem, 3vw, 2rem);
  letter-spacing: 0;
}

.empty-state.hidden {
  display: none;
}

.timebar {
  position: relative;
  width: var(--media-width);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  column-gap: 2px;
  align-items: end;
  padding-bottom: 0;
  margin-top: 2px;
  align-self: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timebar > :first-child {
  position: relative;
  left: auto;
  top: auto;
  z-index: 4;
  align-self: end;
  margin-bottom: 10px;
  padding: 2px 0;
  border-radius: 6px;
  background: rgba(24, 28, 32, 0.92);
  text-align: left;
  transform: none;
  pointer-events: none;
}

.timebar > :last-child {
  position: relative;
  right: auto;
  top: auto;
  z-index: 4;
  align-self: end;
  margin-bottom: 10px;
  padding: 2px 0;
  border-radius: 6px;
  background: rgba(24, 28, 32, 0.92);
  text-align: right;
  transform: none;
  pointer-events: none;
}

.timeline-shell {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 58px;
  display: flex;
  align-items: flex-end;
}

#seekSlider {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 42px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  accent-color: var(--progress);
}

#seekSlider:focus,
#seekSlider:focus-visible {
  outline: none;
}

#seekSlider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      var(--progress) 0%,
      var(--progress) var(--seek-percent, 0%),
      var(--line) var(--seek-percent, 0%),
      var(--line) 100%
    );
}

#seekSlider::-webkit-slider-thumb {
  width: var(--slider-thumb-size);
  height: var(--slider-thumb-size);
  margin-top: -4px;
  border: 2px solid #101214;
  border-radius: 999px;
  background: var(--progress);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
  appearance: none;
  -webkit-appearance: none;
}

#seekSlider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

#seekSlider::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--progress);
}

#seekSlider::-moz-range-thumb {
  width: var(--slider-thumb-size);
  height: var(--slider-thumb-size);
  border: 2px solid #101214;
  border-radius: 999px;
  background: var(--progress);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}

.loop-range-marker {
  position: absolute;
  left: var(--loop-left, 0%);
  right: calc(100% - var(--loop-right, 0%));
  top: calc(100% - 21px);
  z-index: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(243, 179, 90, 0.28);
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
}

.loop-range-marker.visible {
  opacity: 1;
}

.loop-marker {
  position: absolute;
  left: var(--marker-left, 0%);
  bottom: 40px;
  z-index: 3;
  width: 9px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #101214;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}

.loop-marker.visible {
  display: flex;
}

.loop-marker-a {
  background: var(--marker-a);
}

.loop-marker-b {
  background: var(--marker-b);
}

.marker-label {
  position: absolute;
  top: 50%;
  min-width: 48px;
  white-space: nowrap;
  border: 1px solid rgba(16, 18, 20, 0.72);
  border-radius: 999px;
  padding: 5px 8px;
  color: #101214;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.marker-label-a {
  right: calc(100% + 5px);
  text-align: right;
  background: var(--marker-a);
}

.marker-label-b {
  left: calc(100% + 5px);
  text-align: left;
  background: var(--marker-b);
}

.control-row {
  width: var(--media-width);
  display: grid;
  grid-template-columns: repeat(9, minmax(48px, 1fr));
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  align-self: center;
  scrollbar-width: thin;
}

.icon-button {
  width: 100%;
  min-width: 52px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Symbol", sans-serif;
  font-size: 1rem;
  font-weight: 800;
}

#restartBtn > span[aria-hidden="true"] {
  font-size: 1.98rem;
  line-height: 1;
  transform: translateY(-2px);
}

#toggleLoopBtn > span[aria-hidden="true"] {
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-2px);
}

#rewindBtn > span[aria-hidden="true"],
#forwardBtn > span[aria-hidden="true"] {
  font-size: 1.1rem;
  line-height: 1;
}

.icon-button:hover,
.icon-button.keyboard-active,
.toggle-button[aria-pressed="true"] {
  border-color: rgba(243, 179, 90, 0.82);
  background: rgba(243, 179, 90, 0.18);
  color: #ffc373;
}

.control-row .icon-button:focus,
.control-row .icon-button:focus-visible {
  outline: none;
}

.icon-button.keyboard-active {
  transform: translateY(1px);
}

.favorite-button {
  border-color: rgba(243, 179, 90, 0.42);
  background: transparent;
  color: var(--accent-2);
  font-size: 1.45rem;
  line-height: 1;
}

.favorite-button:hover,
.favorite-button.keyboard-active {
  border-color: rgba(243, 179, 90, 0.82);
  background: rgba(243, 179, 90, 0.12);
  color: #ffc373;
}

.favorite-button.is-favorite {
  border-color: rgba(243, 179, 90, 0.82);
  background: rgba(243, 179, 90, 0.18);
  color: var(--accent-2);
}

@media (hover: none) {
  .control-row .icon-button:hover:not(.play-button):not(.keyboard-active):not(.marker-set):not(.is-favorite):not([aria-pressed="true"]) {
    border-color: var(--line);
    background: #242a30;
    color: var(--text);
  }

  .control-row .play-button:hover:not(.keyboard-active) {
    border-color: rgba(243, 179, 90, 0.72);
    background: var(--accent-2);
    color: #170f04;
  }

  .control-row #setABtn:hover:not(.keyboard-active):not(.marker-set) {
    border-color: rgba(53, 224, 194, 0.42);
    background: #242a30;
    color: #8df6e5;
  }

  .control-row #setBBtn:hover:not(.keyboard-active):not(.marker-set) {
    border-color: rgba(65, 223, 255, 0.42);
    background: #242a30;
    color: #9beeff;
  }

  .control-row .favorite-button:hover:not(.keyboard-active):not(.is-favorite) {
    border-color: rgba(243, 179, 90, 0.42);
    background: transparent;
    color: var(--accent-2);
  }
}

.play-button {
  min-width: 56px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(243, 179, 90, 0.72);
  background: var(--accent-2);
  color: #170f04;
  font-size: 1.5rem;
  font-weight: 800;
}

.play-button > span[aria-hidden="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  transform: translateY(-1px);
}

.pause-symbol {
  gap: 0.14em;
}

.pause-symbol::before,
.pause-symbol::after {
  content: "";
  display: block;
  width: 0.18em;
  height: 0.76em;
  border-radius: 1px;
  background: currentColor;
}

.play-button.is-playing > span[aria-hidden="true"] {
  font-size: 1.2em;
}

.play-button:hover {
  background: #ffc373;
  color: #170f04;
}

#setABtn {
  border-color: rgba(53, 224, 194, 0.42);
  color: #8df6e5;
}

#setABtn:hover,
#setABtn.keyboard-active {
  border-color: rgba(53, 224, 194, 0.82);
  background: rgba(53, 224, 194, 0.18);
  color: var(--marker-a);
}

#setBBtn {
  border-color: rgba(65, 223, 255, 0.42);
  color: #9beeff;
}

#setBBtn:hover,
#setBBtn.keyboard-active {
  border-color: rgba(65, 223, 255, 0.82);
  background: rgba(65, 223, 255, 0.16);
  color: var(--marker-b);
}

#setABtn.marker-set {
  border-color: rgba(53, 224, 194, 0.82);
  background: rgba(53, 224, 194, 0.18);
  color: var(--marker-a);
}

#setBBtn.marker-set {
  border-color: rgba(65, 223, 255, 0.82);
  background: rgba(65, 223, 255, 0.16);
  color: var(--marker-b);
}

.speed-control {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  color: var(--muted);
}

.speed-control span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.speed-control select {
  width: 100%;
  min-width: 52px;
  max-width: none;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 6px;
  background: #15191d;
  color: var(--text);
  text-align: center;
}

.speed-control select:hover {
  border-color: rgba(243, 179, 90, 0.82);
  background: #15191d;
  color: var(--text);
}

.speed-control.keyboard-active select {
  border-color: rgba(243, 179, 90, 0.82);
  background: #15191d;
  color: var(--text);
}

.speed-control select:focus-visible {
  outline: none;
  outline-offset: 0;
  border-color: var(--line);
  background: #15191d;
  color: var(--text);
}

.speed-control select:focus {
  outline: none;
  outline-offset: 0;
}

.toggle-button[aria-pressed="true"] {
  border-color: rgba(243, 179, 90, 0.82);
  background: rgba(243, 179, 90, 0.18);
  color: #ffc373;
}

.top-menu-bar {
  align-self: end;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.mobile-actions-menu {
  display: contents;
}

.mobile-menu-summary {
  display: none;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242a30;
  color: var(--text);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.mobile-actions-panel {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.top-menu {
  position: relative;
}

.file-button,
.top-menu summary {
  min-height: 42px;
  min-width: 112px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242a30;
  color: var(--text);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.top-menu summary::-webkit-details-marker {
  display: none;
}

.top-menu summary:hover,
.top-menu[open] summary,
.mobile-menu-summary:hover,
.mobile-actions-menu.open > .mobile-menu-summary {
  border-color: rgba(243, 179, 90, 0.82);
  background: rgba(243, 179, 90, 0.18);
  color: #ffc373;
}

.top-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 28, 32, 0.98);
  box-shadow: var(--shadow);
}

.shortcuts-menu-panel {
  width: min(640px, calc(100vw - 48px));
}

.shortcut-list {
  display: grid;
  gap: 8px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) 132px 160px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.shortcut-header {
  min-height: 32px;
  padding-block: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.shortcut-header-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shortcut-default-button {
  min-width: 0;
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: none;
}

.shortcut-row span {
  min-width: 0;
  color: var(--muted);
}

.shortcut-key {
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  background: #111518;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.pedal-key {
  padding: 0 8px;
  font-family: inherit;
}

.pedal-map {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
}

.pedal-map-button {
  min-width: 0;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(174, 183, 178, 0.22);
  border-radius: 4px;
  background: rgba(174, 183, 178, 0.08);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.pedal-map-button.is-short,
.pedal-map-button.is-double,
.pedal-map-button.is-combo {
  border-color: rgba(243, 179, 90, 0.72);
  background: rgba(243, 179, 90, 0.24);
  color: var(--accent-2);
}

.pedal-map-button.is-long {
  border-color: rgba(243, 179, 90, 0.86);
  background: rgba(243, 179, 90, 0.24);
  color: var(--accent-2);
}

.shortcut-key.listening {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.shortcut-key.pedal-listening {
  animation: pedal-listening-pulse 760ms ease-in-out infinite;
  background: rgba(243, 179, 90, 0.16);
  box-shadow: 0 0 0 0 rgba(243, 179, 90, 0.26);
}

.shortcut-key.pedal-saved {
  animation: pedal-saved-pop 420ms ease-out;
  border-color: rgba(87, 199, 162, 0.9);
  background: rgba(87, 199, 162, 0.18);
  color: var(--accent);
}

@keyframes pedal-listening-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 179, 90, 0.26);
    transform: scale(1);
  }

  55% {
    box-shadow: 0 0 0 7px rgba(243, 179, 90, 0);
    transform: scale(1.035);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(243, 179, 90, 0);
    transform: scale(1);
  }
}

@keyframes pedal-saved-pop {
  0% {
    transform: scale(0.96);
  }

  55% {
    transform: scale(1.045);
  }

  100% {
    transform: scale(1);
  }
}

.favorites-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.favorites-empty {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15191d;
  color: var(--muted);
  font-size: 0.9rem;
}

.favorite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  min-width: 0;
}

.favorite-load-button,
.favorite-remove-button {
  min-height: 42px;
  background: var(--panel-2);
}

.favorite-load-button {
  min-width: 0;
  padding: 0 12px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-remove-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.favorite-remove-button:hover {
  border-color: rgba(255, 111, 97, 0.82);
  background: rgba(255, 111, 97, 0.16);
  color: var(--danger);
}

.secondary-button {
  margin-top: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 940px) {
  .app-shell {
    padding: 14px;
  }

  .player-workspace {
    min-height: calc(100vh - 28px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
  }

  .topbar,
  .stage-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .video-frame {
    width: 100%;
    max-height: none;
  }

  .timebar,
  .control-row {
    width: 100%;
  }

  .control-row {
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: 4px;
    overflow-x: visible;
  }

  #restartBtn {
    grid-column: 1 / 6;
    grid-row: 1;
  }

  #rewindBtn {
    grid-column: 6 / 11;
    grid-row: 1;
  }

  #playPauseBtn {
    grid-column: 11 / 16;
    grid-row: 1;
  }

  #forwardBtn {
    grid-column: 16 / 21;
    grid-row: 1;
  }

  #setABtn {
    grid-column: 1 / 5;
    grid-row: 2;
  }

  #setBBtn {
    grid-column: 5 / 9;
    grid-row: 2;
  }

  #toggleLoopBtn {
    grid-column: 9 / 13;
    grid-row: 2;
  }

  .speed-control {
    grid-column: 13 / 17;
    grid-row: 2;
  }

  .favorite-button {
    grid-column: 17 / 21;
    grid-row: 2;
  }

  .control-row .play-button,
  .control-row .play-button:hover,
  .control-row .play-button:focus,
  .control-row .play-button:focus-visible,
  .control-row .play-button.keyboard-active {
    border-color: rgba(243, 179, 90, 0.72);
    background: var(--accent-2);
    color: #170f04;
  }
}

@media (max-width: 560px) {
  .player-workspace {
    gap: 4px;
  }

  .stage-panel {
    padding-top: 3px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    height: auto;
    min-height: 0;
    overflow: visible;
    align-items: end;
  }

  .url-stack {
    gap: 6px;
  }

  .app-title {
    font-size: 1.02rem;
  }

  .top-menu-bar {
    justify-content: flex-end;
  }

  .mobile-actions-menu {
    position: relative;
    display: block;
  }

  .mobile-menu-summary {
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
  }

  .mobile-actions-panel {
    position: fixed;
    top: 64px;
    right: 14px;
    z-index: 24;
    width: max-content;
    min-width: 132px;
    max-width: calc(100vw - 28px);
    max-height: min(70vh, 520px);
    padding: 10px;
    display: none;
    gap: 8px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(24, 28, 32, 0.98);
    box-shadow: var(--shadow);
  }

  .mobile-actions-menu.open > .mobile-actions-panel {
    display: grid;
  }

  .top-menu {
    position: static;
  }

  .file-button,
  .top-menu summary {
    width: 100%;
    min-width: 112px;
  }

  .top-menu-panel {
    position: static;
    width: auto;
    max-height: 45vh;
    margin-top: 8px;
    padding: 10px;
    box-shadow: none;
  }

  .url-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .primary-button {
    width: 100%;
    min-width: 52px;
    padding: 0;
    font-size: 0.86rem;
  }

  .timebar {
    column-gap: 2px;
    font-size: 0.86rem;
  }

  .speed-control {
    justify-content: center;
  }

  .speed-control select {
    min-width: 34px;
    max-width: none;
    padding: 0 6px;
  }

  .control-row {
    gap: 4px;
  }

  .icon-button {
    min-width: 34px;
    font-size: 0.9rem;
  }

  .shortcut-row {
    grid-template-columns: minmax(54px, 0.7fr) minmax(104px, 1fr) minmax(104px, 1fr);
    gap: 6px;
    padding-inline: 8px;
  }

  .shortcut-key {
    padding: 0 6px;
    font-size: 0.74rem;
  }

  .favorite-row {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .favorite-remove-button {
    width: 40px;
    min-width: 40px;
  }
}
