:root {
  --ink: #182225;
  --muted: #5f6d70;
  --line: #d9e0e1;
  --soft: #f4f7f6;
  --paper: #ffffff;
  --accent: #ba2f35;
  --accent-dark: #8e2025;
  --green: #276b54;
  --focus: #0d6fa6;
  --shadow: 0 12px 30px rgba(24, 34, 37, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #eef2f1;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 32px;
  color: #f7f9f8;
  background: #202b2e;
  border-bottom: 4px solid var(--accent);
}

.site-brand {
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.site-kicker {
  color: #c8d1d1;
  font-size: 11px;
  font-weight: 700;
}

.page-shell {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.intro {
  max-width: 840px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.28;
  letter-spacing: 0;
}

.title-line {
  display: inline;
}

.lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.input-panel {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel h2,
.result-section h2,
.usage-note h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.4;
  letter-spacing: 0;
}

.field-label {
  display: block;
  margin: 18px 0 7px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aebabc;
  border-radius: 6px;
}

input[type="text"]:focus {
  outline: 3px solid rgba(13, 111, 166, 0.2);
  border-color: var(--focus);
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-message {
  min-height: 27px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
}

.status-message[data-kind="error"] {
  color: #9d2028;
}

.status-message[data-kind="success"] {
  color: var(--green);
}

.status-message[data-kind="loading"] {
  color: #385f69;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:focus-visible,
.sizes-toggle:focus-visible {
  outline: 3px solid rgba(13, 111, 166, 0.28);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button-secondary {
  color: #263537;
  background: #fff;
  border-color: #9dabad;
}

.button-secondary:hover {
  background: var(--soft);
  border-color: #657578;
}

.button-quiet {
  color: #344649;
  background: transparent;
  border-color: #aebabc;
}

.button-wide {
  width: 100%;
  min-height: 50px;
}

.result-section {
  scroll-margin-top: 16px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #c8d2d2;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 26px;
  align-items: start;
}

.preview-frame {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 340px;
  margin: 0;
  overflow: hidden;
  background: #162023;
  border: 1px solid #334247;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.preview-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: contain;
}

.result-details {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quality-name {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

.metadata-list {
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
}

.metadata-list > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metadata-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metadata-list dd {
  min-width: 0;
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.primary-actions .button-wide {
  grid-column: 1 / -1;
}

.rights-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sizes-disclosure {
  margin-top: 28px;
  border-top: 1px solid #becaca;
  border-bottom: 1px solid #becaca;
}

.sizes-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  padding: 12px 2px;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-weight: 800;
  cursor: pointer;
}

.toggle-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: #334649;
  border-radius: 50%;
  line-height: 1;
}

.sizes-panel {
  padding: 4px 0 24px;
}

.sizes-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

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

.size-card {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.size-thumb {
  display: grid;
  place-items: center;
  min-height: 142px;
  background: #1c272a;
}

.size-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 180px;
  object-fit: contain;
}

.size-card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.size-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.size-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.size-download {
  width: 100%;
  font-size: 13px;
}

.usage-note {
  margin-top: 40px;
  padding: 22px 24px;
  background: #e3ece8;
  border-left: 4px solid var(--green);
}

.usage-note h2 {
  font-size: 18px;
}

.usage-note p {
  margin: 7px 0 0;
  color: #3c5051;
}

.site-footer {
  padding: 28px 24px 34px;
  color: #bdc8c8;
  background: #202b2e;
  text-align: center;
  font-size: 12px;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  color: #f6f8f8;
}

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

  .result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
  }

  .result-details .quality-name,
  .result-details .rights-note {
    grid-column: 1 / -1;
  }

  .primary-actions {
    align-self: start;
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 54px;
    padding: 0 16px;
  }

  .page-shell {
    width: min(100% - 32px, 1160px);
    padding: 28px 0 50px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.35;
  }

  .title-line {
    display: block;
  }

  .lead {
    font-size: 15px;
  }

  .input-panel {
    padding: 18px 16px;
  }

  .input-panel h2,
  .result-section h2 {
    font-size: 21px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .preview-frame {
    min-height: 190px;
  }

  .result-details {
    display: block;
    padding: 17px 15px;
  }

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

  .usage-note {
    padding: 18px 16px;
  }
}

@media (max-width: 390px) {
  .site-kicker {
    display: none;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .primary-actions .button-wide {
    grid-column: auto;
  }

  .size-card {
    grid-template-columns: 1fr;
  }

  .size-thumb {
    min-height: 170px;
  }
}


.yt-ad-reserve,
.yt-comments,
.yt-return-links {
  margin-top: 32px;
}

.yt-ad-reserve {
  min-height: 112px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
}

.yt-ad-slot {
  min-height: 86px;
  text-align: center;
}

.yt-ad-slot > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.yt-comments {
  padding: 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.yt-return-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  padding: 6px;
}

.yt-return-links a {
  color: var(--accent-dark);
  font-weight: 800;
}

@media (max-width: 680px) {
  .yt-comments {
    padding: 14px 8px;
  }

  .yt-return-links {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
