:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --text: #ffffff;
  --text-muted: #888888;
  --text-subtle: #555555;
  --accent: #fbbf24;
  --accent-hover: #fcd34d;
  --success: #4ade80;
  --error: #ef4444;
  --border: #2a2a2a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 30px;
  padding: 48px 24px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-block__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.howto-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.howto-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(251, 191, 36, 0.45);
  transform: translateY(-1px);
}

.howto-dialog {
  padding: 0;
  border: none;
  border-radius: 16px;
  max-width: calc(100vw - 32px);
  width: min(24rem, 100%);
  max-height: min(90vh, 34rem);
  overflow: auto;
  margin: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(165deg, #242424 0%, #1a1a1a 55%, #171717 100%);
  color: var(--text);
  border: 1px solid rgba(253, 224, 71, 0.28);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.12),
    0 20px 56px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(251, 191, 36, 0.08);
}

.howto-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.howto-dialog__inner {
  padding: 1.25rem 1.35rem 1.3rem;
  text-align: left;
}

.howto-dialog__title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.85rem;
  line-height: 1.2;
  background: linear-gradient(165deg, #fffbeb 0%, #fde68a 28%, #fbbf24 55%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .howto-dialog__title {
    color: #fcd34d;
    -webkit-text-fill-color: unset;
  }
}

.howto-dialog__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: howto-step;
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
}

.howto-dialog__list li {
  position: relative;
  margin-bottom: 0.55rem;
  padding-left: 2.35rem;
  min-height: 1.55rem;
  counter-increment: howto-step;
}

.howto-dialog__list li::before {
  content: counter(howto-step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: #1c1917;
  background: linear-gradient(155deg, #fef9c3 0%, #fde047 35%, #fbbf24 72%, #ea580c 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.howto-dialog__close {
  margin-top: 1rem;
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: linear-gradient(180deg, #2a2418 0%, #1f1c14 100%);
  color: #fef3c7;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.howto-dialog__close:hover {
  background: linear-gradient(180deg, #352e22 0%, #2a2418 100%);
  border-color: rgba(253, 224, 71, 0.55);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.15);
}

.howto-dialog__example {
  margin-top: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  font-size: 0.82rem;
  line-height: 1.52;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
}

.howto-dialog__example-title {
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: #fcd34d;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.howto-dialog__example-body {
  margin: 0;
}

/* Wordmark: same Pretendard as body (Day 8 spec — not Outfit) */
.app-title {
  font-family: "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.app-title__flag {
  color: var(--text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 32px rgba(0, 0, 0, 0.55);
}

.app-title__lette {
  background: linear-gradient(165deg, #fde68a 0%, #fbbf24 42%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .app-title__lette {
    color: var(--accent);
    -webkit-text-fill-color: unset;
  }
}

.title-emoji {
  font-size: 0.7em;
  vertical-align: middle;
}

.tagline {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.35;
  letter-spacing: 0.01em;
  margin-top: 8px;
}

.daily-complete {
  width: 100%;
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  text-align: center;
}

.daily-complete__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.daily-complete__result,
.daily-complete__attempts,
.daily-complete__bye,
.daily-complete__countdown {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0.4rem 0;
  line-height: 1.5;
}

.daily-complete__note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

#daily-countdown {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.play-mode-banner {
  margin: 0 0 0.25rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
  color: #fef9c3;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 10px;
}

#game-zone {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  width: 100%;
}

#game-zone[hidden] {
  display: none !important;
}

#flag-display {
  width: 100%;
  max-width: min(100%, 440px);
  margin: 0 auto;
}

#flag-display .flag-display-frame {
  width: 100%;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  background: var(--surface);
  aspect-ratio: 3 / 2;
  max-height: min(52vh, 300px);
}

#flag-display .flag-display-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #141414;
}

#attempts {
  font-size: clamp(1rem, 3.2vw, 1.12rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.96);
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.09);
  border: 1px solid rgba(251, 191, 36, 0.22);
  text-align: center;
}

#hints {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
}

#hints:empty {
  display: none;
}

.hint-line {
  background-color: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
}

.hint-line--enter {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.hint-line--enter.hint-line--visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 480px) {
  .hint-line {
    font-size: 0.8rem;
    padding: 10px 14px;
  }
}

.guess-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

.guess-row #guess-input {
  flex: 1 1 auto;
  min-width: 0;
}

#guess-input {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  background-color: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  transition: all 0.2s ease;
}

#guess-input::placeholder {
  color: var(--text-subtle);
}

#guess-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

#guess-input:disabled {
  opacity: 0.55;
}

#submit-btn {
  flex: 0 0 auto;
  min-width: 5.5rem;
  min-height: 44px;
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#submit-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.share-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

#share-row[hidden] {
  display: none !important;
}

.share-btn {
  width: auto;
  max-width: 14rem;
  min-height: 44px;
  background-color: var(--surface);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    transform 0.2s ease, box-shadow 0.2s ease;
}

.share-btn:hover {
  background-color: var(--surface-hover);
  border-color: rgba(251, 191, 36, 0.4);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.share-btn:active {
  transform: translateY(0);
}

.daily-complete .share-btn {
  margin-top: 0.65rem;
}

#feedback {
  min-height: 2.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

#feedback.feedback-success {
  color: var(--success);
  animation: feedbackSuccessPop 0.4s ease;
}

#feedback.feedback-error {
  color: var(--error);
}

@keyframes feedbackSuccessPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.share-dialog {
  padding: 0;
  border: none;
  border-radius: 14px;
  max-width: calc(100vw - 32px);
  width: 22rem;
  max-height: min(90vh, 36rem);
  overflow: auto;
  margin: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.share-dialog__inner {
  padding: 1.1rem 1.15rem 1.15rem;
  text-align: left;
}

.share-dialog__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.share-dialog__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}

.share-dialog__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.share-dialog__close:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: rgba(251, 191, 36, 0.35);
}

.share-dialog__sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.85rem;
}

.share-dialog__grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.share-dialog__btn {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: rgba(255, 255, 255, 0.95);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.share-dialog__btn:hover {
  background: var(--surface-hover);
  border-color: rgba(251, 191, 36, 0.35);
  transform: translateY(-1px);
}

.share-dialog__btn:active {
  transform: translateY(0);
}

.share-dialog__btn--system {
  border-color: rgba(251, 191, 36, 0.45);
}

.share-dialog__btn--facebook {
  border-color: rgba(24, 119, 242, 0.45);
}

.share-dialog__btn--x {
  border-color: rgba(255, 255, 255, 0.28);
}

.share-dialog__btn--instagram {
  border-color: rgba(228, 64, 95, 0.45);
}

.share-dialog__btn--tiktok {
  border-color: rgba(105, 201, 208, 0.45);
}

.share-dialog__status {
  min-height: 1.25rem;
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--success);
  line-height: 1.35;
}

.share-dialog__copy {
  margin-top: 0.75rem;
  width: 100%;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.share-dialog__copy:hover {
  color: var(--accent);
}
