:root {
  --bg: #141414;
  --bg-soft: #1b1b1b;
  --surface: rgba(26, 26, 26, 0.9);
  --surface-strong: #202020;
  --text: #e9e9e9;
  --text-muted: #aaaaaa;
  --accent: #d8d8d8;
  --accent-2: #f0f0f0;
  --success: #bdbdbd;
  --warning: #d0d0d0;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #0f0f10;
}

a {
  color: #d4d4d4;
}

a:hover {
  color: #ffffff;
}

#wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.skip-link {
  position: absolute;
  left: 0;
  top: -100%;
  padding: 0.7rem 0.95rem;
  z-index: 1050;
  background: #303030;
  color: #fff;
  border-radius: 0;
}

.skip-link:focus {
  top: 0;
}

.main-nav {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(17, 17, 17, 0.86);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
}

.main-nav .navbar-brand {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #fff;
}

.main-nav .navbar-toggler {
  border-radius: 0;
}

.main-nav .nav-link {
  color: #d2d2d2;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 0;
  padding: 0.38rem 0.75rem;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.main-nav .nav-link:hover,
.main-nav .nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  box-shadow: none;
}

.main-nav .nav-link:active,
.main-nav .nav-link.dropdown-toggle:focus,
.main-nav .nav-link.dropdown-toggle:active {
  outline: none;
  box-shadow: none;
}

.main-nav .nav-link.active {
  color: #2a2a2a !important;
  background: #e9e9e9;
  font-weight: 600;
}

.main-nav .dropdown-menu {
  background: #1e1e1e;
  border: 1px solid var(--border);
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.main-nav .dropdown-item {
  color: #dbdbdb;
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main-nav .dropdown-item:first-child {
  border-top: 0;
}

.main-nav .dropdown-item:hover,
.main-nav .dropdown-item:focus {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.main-nav .dropdown-item.active,
.main-nav .dropdown-item:active {
  color: #2a2a2a !important;
  background: #efefef;
}

.page-shell {
  width: min(1180px, 96vw);
  margin: 1.5rem auto 0;
  padding: clamp(1rem, 2vw, 1.6rem);
}

body.home-page .page-shell {
  width: min(930px, 92vw);
}

.content-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: clamp(1rem, 2.6vw, 2rem);
}

h1,
h2,
h3,
h4,
legend {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #f0f0f0;
  font-weight: 600;
}

h2 {
  margin-bottom: 0.35rem;
}

legend.col-form-label {
  align-self: flex-start;
  padding-top: 0.1rem;
}

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

.btn {
  border-radius: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-primary {
  color: #f5f5f5;
  background: #3b3b3b;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-primary:hover {
  color: #fff;
  background: #4a4a4a;
}

.btn-outline-warning {
  color: #ff0000;
  border-color: #8b8b8b;
}

.btn-outline-warning:hover {
  color: #141414;
  background: #d8d8d8;
}

.btn-icon-swap {
  height: calc(1.8125rem + 2px);
  min-width: 2.6rem;
  padding: 0 0.5rem;
  line-height: 1.2;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-control,
.custom-select,
textarea {
  font-family: "Nunito Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  color: #e8e8e8;
  background: #0f1319;
  border: 1px solid rgba(216, 224, 234, 0.45);
  border-radius: 0;
  box-shadow: none;
}

.form-control.bg-dark,
.custom-select.bg-dark,
textarea.bg-dark {
  background-color: #181818 !important;
}

.form-control::placeholder,
textarea::placeholder {
  color: rgba(232, 232, 232, 0.78);
}

.custom-select {
  cursor: pointer;
  padding-right: 2.4rem;
  background-color: #0f1319;
  background-image:
    linear-gradient(45deg, transparent 50%, #cfd8e6 50%),
    linear-gradient(135deg, #cfd8e6 50%, transparent 50%),
    linear-gradient(to left, rgba(255, 255, 255, 0.08) 2.2rem, transparent 2.2rem);
  background-position:
    calc(100% - 0.95rem) calc(50% - 2px),
    calc(100% - 0.62rem) calc(50% - 2px),
    100% 0;
  background-size: 7px 7px, 7px 7px, 100% 100%;
  background-repeat: no-repeat;
}

.form-control-file,
input[type="file"] {
  display: none !important;
}

.file-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}

.file-input-wrap.is-dragover .file-input-button {
  border-color: #ff0000;
  background: #3a3a3a;
  color: #ffffff;
}

.file-input-button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #2d2d2d;
  color: #f2f2f2;
  padding: 0.35rem 0.85rem;
  border-radius: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
}

.file-input-button:hover,
.file-input-button:focus {
  color: #ffffff;
  background: #3a3a3a;
}

.file-input-status {
  display: inline-block;
  font-size: 0.84rem;
  color: #b8b8b8;
  vertical-align: middle;
  max-width: min(60ch, calc(100vw - 14rem));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-input-status.is-empty {
  display: none;
}

.file-input-status.is-error {
  color: #ff6262;
}

.form-upload-error {
  display: none;
  margin: 0.35rem 0 0.55rem;
  color: #ff6262;
  font-size: 0.9rem;
}

.form-upload-error.is-visible {
  display: block;
}

.form-upload-error.is-flash {
  animation: uploadErrorFlash 380ms ease-out;
}

@keyframes uploadErrorFlash {
  0% {
    opacity: 0.35;
    transform: translateY(-1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

button[type="submit"]:disabled,
input[type="submit"]:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  color: #c8c8c8 !important;
}

.submit-tooltip-wrap {
  position: relative;
  display: inline-block;
}

.form-control:focus,
textarea:focus {
  color: #fff;
  background: #141922;
  border-color: rgba(230, 237, 247, 0.75);
  box-shadow: none;
}

.form-control.bg-dark:focus,
.custom-select.bg-dark:focus,
textarea.bg-dark:focus {
  background-color: #141922 !important;
}

.custom-select:focus {
  background-color: #141922;
  border-color: rgba(216, 224, 234, 0.55);
  background-image:
    linear-gradient(45deg, transparent 50%, #cfd8e6 50%),
    linear-gradient(135deg, #cfd8e6 50%, transparent 50%),
    linear-gradient(to left, rgba(255, 255, 255, 0.08) 2.2rem, transparent 2.2rem);
}

.form-check {
  min-height: 1.5rem;
  margin-bottom: 0.25rem;
  padding-left: 0;
}

.form-check-input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.form-check-input[type="radio"]:focus {
  outline: none;
  box-shadow: none;
}

.form-check-input[type="radio"] + .form-check-label {
  display: inline-block;
  color: #d4d4d4;
  background: #222222;
  border: 1px solid rgba(216, 224, 234, 0.45);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.form-check-input[type="radio"] + .form-check-label:hover {
  border-color: rgba(216, 224, 234, 0.62);
}

.form-check-input[type="radio"]:checked + .form-check-label {
  color: #1e1e1e;
  background: #dde4ef;
  border-color: #dde4ef;
}

.form-check-input[type="radio"]:focus + .form-check-label {
  border-color: rgba(216, 224, 234, 0.7);
}

.form-check-input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: static;
  width: 0.95rem;
  height: 0.95rem;
  margin-top: 0;
  margin-left: 0;
  margin-right: 0.45rem;
  border: 1px solid rgba(216, 224, 234, 0.55);
  border-radius: 0;
  background: #262c35;
  box-shadow: none;
  cursor: pointer;
  flex: 0 0 auto;
}

.form-check-input[type="checkbox"]:focus {
  outline: none;
  box-shadow: none;
  border-color: rgba(216, 224, 234, 0.75);
}

.form-check-input[type="checkbox"]:checked {
  border-color: #ff0000;
  background-color: #ff0000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='square' stroke-linejoin='miter' d='M3.2 8.4l2.5 2.7 7-7'/%3E%3C/svg%3E");
  background-size: 78% 78%;
  background-position: center;
  background-repeat: no-repeat;
}

.form-check-input[type="checkbox"] + .form-check-label {
  color: #d4d4d4;
  padding-left: 0;
  display: inline-flex;
  align-items: center;
}

.choice-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: auto;
}

.choice-inline .form-check {
  margin: 0;
}

.choice-inline .form-check + .form-check {
  margin-left: -1px;
}

.choice-inline .form-check .form-check-label {
  height: 100%;
  display: inline-flex;
  align-items: center;
  border-radius: 0;
}

.offset-sign-group .form-check-input[type="radio"] + .form-check-label {
  padding: 0.22rem 0.5rem;
  font-size: 0.92rem;
  min-width: 0;
  justify-content: flex-start;
}

.timecode-swap-group .form-check-input[type="radio"] + .form-check-label {
  width: 13rem;
  justify-content: center;
}

.table {
  color: #ededed;
}

.table th,
.table td {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.footer {
  position: static;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: center;
  padding: 0.95rem 0.75rem 1.25rem;
}

.footer a {
  color: #d8d8d8;
}

.home-hero {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  align-items: center;
  padding: 1rem;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1.3rem;
}

.brand-block h1 {
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  margin: 0;
}

.brand-block p {
  margin-top: 0.45rem;
  font-size: 1rem;
  max-width: 62ch;
}

.home-logo {
  text-align: center;
}

.home-logo img {
  max-width: 100%;
  height: auto;
}

.home-narrow {
  width: min(870px, 100%);
  margin: 0 auto;
}

.home-narrow .tool-group h3 {
  text-align: center;
}

.home-narrow .tool-link {
  text-align: center;
}

.home-narrow .tool-link:hover {
  color: #ff0000;
  border-color: #ff0000;
}

.home-narrow .btn-primary.tool-link:focus,
.home-narrow .btn-primary.tool-link:active,
.home-narrow .btn-primary.tool-link.active,
.home-narrow .btn-primary.tool-link:not(:disabled):not(.disabled):active,
.home-narrow .show > .btn-primary.tool-link.dropdown-toggle {
  color: #ffffff;
  background: #ff0000;
  border-color: #ff0000;
  box-shadow: none;
  outline: none;
}

.longplay-mode-row .form-check-label {
  white-space: nowrap;
}

.tool-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tool-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-tool-columns .tool-column:first-child .tool-group:first-child {
  flex: 1;
}

.tool-group {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(21, 21, 21, 0.8);
  border-radius: 0;
  padding: 0.95rem;
}

.tool-group h3 {
  font-size: 1.05rem;
  margin-bottom: 0.7rem;
}

.tool-group p {
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.tool-link {
  display: block;
  text-align: left;
  width: 100%;
}

.fade-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.45s ease forwards;
}

.fade-delay-1 {
  animation-delay: 0.08s;
}

.fade-delay-2 {
  animation-delay: 0.14s;
}

.fade-delay-3 {
  animation-delay: 0.2s;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 991px) {
  .main-nav .navbar-nav {
    gap: 0.3rem;
    padding-top: 0.6rem;
  }

  .home-hero {
    text-align: center;
  }

  .home-logo img {
    max-width: 210px;
  }

  .form-group.row > [class*="col-sm-"],
  .row > [class*="col-sm-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  legend.col-form-label {
    margin-bottom: 0.35rem;
  }

  .choice-inline {
    flex-wrap: wrap;
    overflow: visible;
  }

  .timecode-swap-group .form-check-input[type="radio"] + .form-check-label {
    width: 100%;
  }

  .file-input-wrap {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

@media (max-width: 767px) {
  .page-shell {
    width: 94vw;
    margin-top: 1rem;
    padding: 0.5rem;
  }

  .content-panel {
    border-radius: 0;
    padding: 1rem;
  }

  .tool-columns {
    grid-template-columns: 1fr;
  }

  .tool-column {
    gap: 0.85rem;
  }

  .home-tool-columns .tool-column:first-child .tool-group:first-child {
    flex: initial;
  }

  .tool-group {
    padding: 0.85rem;
  }
}
