:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #60636b;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --line: #d8dad2;
  --mint: #d8f4de;
  --cyan: #d9f1f8;
  --rose: #ffe1e7;
  --lime: #eff8c8;
  --focus: #117a65;
  --shadow: 0 18px 55px rgba(23, 23, 23, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Noto Sans KR", "Malgun Gothic", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  word-break: keep-all;
}

body.lightbox-open {
  overflow: hidden;
  overscroll-behavior: contain;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  padding: 0 18px;
  cursor: pointer;
}

button.secondary {
  background: var(--panel);
  color: var(--ink);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.9fr) auto;
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: 18px;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 880px;
  font-size: 2.4rem;
  line-height: 1.02;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.intro {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.source-grid {
  justify-self: end;
  width: min(100%, 416px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.source-link {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
}

.source-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.source-link strong {
  font-size: 1.02rem;
  overflow-wrap: anywhere;
  transform: translateY(-1px);
}

.source-logo {
  flex: 0 0 auto;
  width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.x-logo {
  background: #171717;
  color: #ffffff;
  font-weight: 900;
}

.youtube-logo {
  position: relative;
  width: 44px;
  min-height: 30px;
  background: #ff0033;
}

.youtube-logo::after {
  content: "";
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #ffffff;
  margin-left: 3px;
}

.source-link.x {
  background: var(--rose);
}

.source-link.youtube {
  background: var(--cyan);
}

.actions {
  min-width: 176px;
  display: grid;
  gap: 10px;
}

.manual-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.6fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--lime);
}

.exchange-panel {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.exchange-converter,
.rate-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.exchange-converter {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.exchange-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.section-heading.compact {
  display: block;
  margin: 0;
}

.section-heading.compact .eyebrow {
  margin-bottom: 6px;
}

.exchange-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 2px;
  font-size: 0.86rem;
}

.exchange-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  gap: 8px;
}

.exchange-result {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px;
  border-radius: 8px;
  background: var(--lime);
  padding: 0 16px 0 14px;
  text-align: left;
}

.exchange-result span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.exchange-result .flip-value,
.exchange-result .flip-char,
.exchange-result .digit-char {
  color: #000000;
}

.exchange-result strong {
  font-size: 1.12rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
  font-weight: 700;
  color: #000000;
  transform: translateY(-1px);
}

.exchange-status.error {
  color: #9f1d2a;
  font-weight: 800;
}

.auto-note {
  flex: 0 0 auto;
  border: 1px solid #b7d4d1;
  border-radius: 8px;
  background: #e7f7f2;
  color: #0b5d54;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  padding: 8px 10px;
  white-space: nowrap;
}

.exchange-rates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rate-card {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 132px;
  padding: 14px;
}

.rate-pair {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.rate-main {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.rate-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.flip-value {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flip-char {
  display: inline-block;
  transform-origin: 50% 48%;
  will-change: transform, opacity, filter;
}

.digit-char {
  min-width: 0.58em;
  text-align: center;
}

.flip-char.value-change {
  animation: split-flap 700ms cubic-bezier(0.2, 0.74, 0.24, 1);
}

@keyframes split-flap {
  0% {
    opacity: 1;
    transform: perspective(720px) rotateX(0deg) translateY(0);
    filter: brightness(1);
  }

  38% {
    opacity: 0.42;
    transform: perspective(720px) rotateX(-74deg) translateY(-2px);
    filter: brightness(0.82) blur(0.4px);
  }

  52% {
    opacity: 0.52;
    transform: perspective(720px) rotateX(62deg) translateY(2px);
    filter: brightness(1.08) blur(0.3px);
  }

  100% {
    opacity: 1;
    transform: perspective(720px) rotateX(0deg) translateY(0);
    filter: brightness(1);
  }
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
}

select {
  min-height: 44px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.feed-stage {
  --feed-card-width: 720px;
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.feed-tabs {
  display: flex;
  gap: 10px;
  width: min(100%, var(--feed-card-width, 100%));
  justify-self: center;
  max-width: var(--feed-card-width, 100%);
}

.feed-tab {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 800;
}

.feed-tab.active {
  background: var(--ink);
  color: #ffffff;
}

.feed-panels {
  width: 100%;
  min-width: 0;
}

.feed-pane {
  width: 100%;
  display: none;
}

.feed-pane.active {
  display: grid;
  gap: 14px;
}

.section-heading {
  width: min(100%, var(--feed-card-width, 100%));
  justify-self: center;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.section-heading > * {
  margin: 0;
}

.feed-list {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.notice {
  display: none;
  margin-bottom: 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--mint);
  padding: 16px;
  line-height: 1.55;
}

.notice.visible {
  display: block;
}

.notice ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  width: min(100%, var(--feed-card-width, 100%));
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 300px;
  min-height: 0;
  background: #ffffff;
  object-fit: contain;
}

.media-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 300px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: inherit;
  padding: 0;
  overflow: hidden;
}

.media-button .thumb {
  display: block;
  transition: filter 160ms ease, transform 160ms ease;
}

.media-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23, 23, 23, 0.25);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 160ms ease;
}

.media-button:hover .media-overlay,
.media-button:focus-visible .media-overlay {
  opacity: 1;
}

.media-button:hover .thumb,
.media-button:focus-visible .thumb {
  filter: blur(1px) brightness(0.78);
  transform: scale(1.02);
}

.eye-icon {
  position: relative;
  width: 46px;
  height: 28px;
  border: 3px solid #ffffff;
  border-radius: 50% / 58%;
  background: rgba(255, 255, 255, 0.12);
}

.eye-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
}

.item-body {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.summary {
  margin: 0;
  color: #2b2d31;
  line-height: 1.45;
}

.summary-list {
  margin: 0;
  padding-left: 22px;
  color: #2b2d31;
  line-height: 1.45;
}

.summary-list li + li {
  margin-top: 6px;
}

.post-text {
  white-space: pre-wrap;
}

.combined-block {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.combined-post {
  display: grid;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  width: 100%;
}

.related-block {
  display: grid;
  gap: 6px;
  padding-top: 2px;
  width: 100%;
}

.related-block > strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.related-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  padding: 8px 10px;
  text-decoration: none;
}

.related-avatar {
  width: 38px;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}

.related-avatar.placeholder {
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: var(--ink);
  font-weight: 900;
}

.related-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.related-author {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
}

.related-author strong,
.related-author small,
.related-copy em {
  overflow-wrap: break-word;
}

.related-author small {
  color: var(--muted);
}

.related-copy em {
  color: #2b2d31;
  font-style: normal;
  line-height: 1.4;
}

.related-thumb {
  width: min(220px, 100%);
  max-height: 136px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.item-actions a {
  border-bottom: 2px solid var(--focus);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.empty-state {
  border: 1px dashed var(--ink);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(23, 23, 23, 0.72);
  padding: 24px;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border-color: #ffffff;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

@media (max-width: 1120px) {
  .control-panel,
  .exchange-panel {
    grid-template-columns: 1fr;
  }

  .exchange-rates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .source-grid,
  .exchange-controls,
  .exchange-rates,
  .actions {
    grid-template-columns: 1fr;
  }

  .source-grid {
    width: 100%;
  }

  .feed-tabs {
    gap: 8px;
  }

  .feed-tab {
    flex: 1 1 0;
  }

  .exchange-head {
    flex-direction: column;
    align-items: start;
  }

}
