:root {
  color-scheme: light dark;
  --bg: #0f1218;
  --surface: #151a22;
  --surface-2: #1b2130;
  --text: #f5f7fb;
  --text-rgb: 245, 247, 251;
  --muted: #a7b0c0;
  --primary: #6aa7ff;
  --primary-rgb: 106, 167, 255;
  --accent: #7af5c6;
  --border: #2a3242;
  --chip: #1f2635;
  --shadow: 0 18px 40px rgba(7, 10, 18, 0.35);
}

html[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --text: #1c2334;
  --text-rgb: 28, 35, 52;
  --muted: #5e6a7d;
  --primary: #2b6cff;
  --primary-rgb: 43, 108, 255;
  --accent: #12b981;
  --border: #d6dbe6;
  --chip: #eef1f6;
  --shadow: 0 16px 36px rgba(22, 30, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans KR", "Hiragino Kaku Gothic Pro", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden; /* Prevent horizontal scroll for off-canvas menu */
}

html.menu-open,
body.menu-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.menu-open {
  position: fixed;
  left: 0;
  width: 100%;
}

input,
textarea {
  font-family: "Noto Sans KR", "Noto Sans JP", "Noto Sans", sans-serif !important;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

input[type="search"] {
  -webkit-appearance: textfield;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 6vw;
  gap: 16px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  /* Increase z-index on mobile to ensure header (and contained menu) sits above backdrop */
  .site-header {
    z-index: 10005;
  }
}



.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-link {
  text-decoration: none;
  color: inherit;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-mark {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
  overflow: visible;
}

.logo-mark img {
  height: 30px;
  width: auto;
  display: block;
}

html[data-theme="dark"] .logo-mark .logo-light {
  display: none;
}

html[data-theme="light"] .logo-mark .logo-dark {
  display: none;
}

.brand-copy {
  display: block;
  min-width: 0;
}

.brand-site-name {
  display: inline-block;
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-meta-hidden {
  display: none !important;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.site-header p {
  margin: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.language-dropdown {
  position: relative;
}

.language-dropdown__trigger {
  min-width: 154px;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface);
}

.language-dropdown__trigger i {
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.language-dropdown.is-open .language-dropdown__trigger i {
  transform: rotate(180deg);
  color: var(--text);
}

.language-dropdown__current {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.language-dropdown__current-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.language-dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1005;
}

.language-dropdown.is-open .language-dropdown__menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.language-option {
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
}

.language-option > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-flag {
  width: 21px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--border) 80%, white 8%);
  flex-shrink: 0;
}

.language-option:hover {
  background: var(--surface-2);
}

.language-option.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  box-shadow: none;
}

/* PC default: Hide mobile menu button strongly */
.site-header .mobile-menu-btn {
  display: none !important;
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.segmented__btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.segmented__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 24px;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: none;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:not(.primary-btn):not(.pill-btn):not(.segmented__btn):not(.category-chip):not(.tool-btn):not(.mode-btn):not(.ghost-btn):not(.search-clear-btn):not(.overlay-action-btn):not(.custom-btn) {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 24px;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: none;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:not(.primary-btn):not(.pill-btn):not(.segmented__btn):not(.category-chip):not(.tool-btn):not(.mode-btn):not(.ghost-btn):not(.search-clear-btn):not(.overlay-action-btn):not(.custom-btn):hover {
  background: var(--surface-2);
  border-color: var(--muted);
  transform: translateY(-1px);
}

button:not(.primary-btn):not(.pill-btn):not(.segmented__btn):not(.category-chip):not(.tool-btn):not(.mode-btn):not(.ghost-btn):not(.search-clear-btn):not(.overlay-action-btn):not(.custom-btn):active {
  transform: translateY(0);
}

.ghost-btn:hover {
  background: var(--surface-2);
  border-color: var(--muted);
  transform: translateY(-1px);
}

.ghost-btn:active {
  transform: translateY(0);
}

html[data-theme="light"] .ghost-btn {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.6);
  color: #0f172a;
  box-shadow: none;
}

html[data-theme="light"] .ghost-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  box-shadow: none;
}

html[data-theme="light"] .search-clear-btn {
  color: rgba(15, 23, 42, 0.6);
}

html[data-theme="light"] .search-clear-btn:hover {
  color: #0f172a;
}

#theme-toggle,
#theme-toggle-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.container {
  padding: 0 6vw 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.hero,
.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  margin: 60px 0 48px;
  position: relative;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero h2,
.hero-section h2 {
  font-size: 3rem;
  margin: 0 0 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.hero p,
.hero-section p {
  margin: 0 auto;
  color: var(--muted);
  max-width: 600px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.search {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.search input {
  width: 100%;
  padding: 16px 24px 16px 52px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 12px 32px rgba(106, 167, 255, 0.15);
}

.search__icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Interactive Card (Timezone reference-time/control panel style) */
.interactive-card,
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 25px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.search-input-row {
  display: flex;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto 40px;
  align-items: flex-start;
}

.search-input-row .search-container {
  flex: 1;
  margin: 0;
  max-width: none;
}

.search-input-row .primary-btn {
  min-width: 100px;
  height: 60px;
  padding: 12px 30px;
}

/* Shared Search Bar (Flag Viewer style) */
.search-bar-wrapper,
.search-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 40px;
}

.main-search-input {
  width: 100%;
  padding: 18px 64px 18px 56px;
  font-size: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  font-family: inherit;
}

.main-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 106, 167, 255), 0.1);
}

.main-search-input.has-action {
  padding-right: 132px;
}

.search-icon,
.search-icon-left {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--muted);
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.search-clear-btn[style*="flex"] {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.search-clear-btn:hover {
  color: var(--text);
}

.search-action-row {
  display: flex;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto 40px;
  justify-content: flex-start;
}

/* Shared Pill Button (User-Agent copy button style) */
.pill-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 25px;
  padding: 12px 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--border);
}

.pill-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pill-btn.primary:hover {
  filter: brightness(1.05);
}

/* Shared Overlay Action Button (for floating controls) */
.overlay-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  transition: all 0.2s ease;
  padding: 0;
}

.overlay-action-btn:hover {
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

.overlay-action-btn--danger:hover {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
  box-shadow: 0 10px 18px rgba(239, 68, 68, 0.35);
}

.search-btn-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Custom Select (Timezone Calculator style) */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  min-width: 80px;
}

.select-wrapper--sm .custom-select-wrapper {
  width: 100%;
  min-width: 160px;
}

.custom-select-wrapper select {
  display: none;
}

.select-selected {
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 25px;
  padding: 10px 36px 10px 16px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.select-selected::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  width: 10px;
  height: 10px;
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Cpath fill=%22%23999%22 fill-rule=%22evenodd%22 d=%22M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.select-selected:hover {
  background-color: var(--border);
}

.select-selected.select-arrow-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 106, 167, 255), 0.1);
}

.select-selected.select-arrow-active::after {
  transform: translateY(-50%) rotate(180deg);
}

.select-items {
  position: absolute;
  background-color: var(--surface);
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 99;
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  opacity: 0;
  transform: translateY(-10px);
  animation: dropdownOpen 0.2s forwards ease-out;
}

.select-items.select-hide {
  display: none;
}

.select-items div {
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--surface-2);
  font-size: 0.9rem;
  transition: background-color 0.1s;
}

.select-items div:last-child {
  border-bottom: none;
  border-radius: 0 0 12px 12px;
}

.select-items div:first-child {
  border-radius: 12px 12px 0 0;
}

.select-items div:hover,
.same-as-selected {
  background-color: var(--surface-2);
  color: var(--primary);
}

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

/* Shared Card Hover (IP Tracker style) */
.stat-card,
.content-card,
.flag-card,
.timeline-row {
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

.stat-card:hover,
.content-card:hover,
.flag-card:hover,
.timeline-row:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

@media (max-width: 640px) {
  .search-bar-wrapper,
  .search-container {
    margin-bottom: 24px;
  }

  .search-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .main-search-input.has-action {
    padding-right: 24px;
  }

  .search-btn-right {
    position: static;
    transform: none;
    width: 100%;
    justify-content: center;
  }
}

.search__icon i {
  font-size: 1.2rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 4px;
}

.badge {
  background: var(--surface-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 180px;
  box-shadow: var(--shadow);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.tool-card--coming {
  opacity: 0.6;
  filter: grayscale(0.5);
  cursor: default;
  background: var(--surface-2);
}

.tool-card--coming:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--primary);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.tool-card:hover .tool-icon {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05) rotate(-5deg);
}

.tool-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 8px 0 0;
  line-height: 1.3;
}

.tool-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all 0.2s ease;
  margin-top: auto;
  align-self: flex-end;
}

.tool-card:hover .tool-arrow {
  background: var(--surface-2);
  color: var(--text);
  transform: translateX(4px);
}

.site-footer {
  padding: 60px 6vw 40px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* Shared Toast (YouTube Thumbnail style) */
#toast-container {
  position: fixed;
  bottom: 32px;
  left: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  align-items: center;
}

.toast {
  background: #333;
  color: #fff;
  padding: 16px 32px;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(20px);
  animation: toast-in 0.3s forwards;
  border: 1px solid rgba(51, 51, 51, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(1000px, 90%);
  flex-wrap: nowrap;
  align-self: center;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: hidden;
}

.toast i {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
}

.toast.is-success {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}

.toast.is-error {
  background: #ef4444;
  color: #fff;
  border-color: #dc2626;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@media (max-width: 900px) {
  .hero {
    margin: 40px 0 32px;
    padding: 0 16px;
  }

  .hero h2 {
    font-size: 2.2rem;
  }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-group--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.filter-label {
  color: var(--muted);
  font-weight: 600;
}

.select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-width: 160px;
  box-shadow: var(--shadow);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip.is-selected {
  background: rgba(106, 167, 255, 0.18);
  border-color: rgba(106, 167, 255, 0.6);
  color: var(--text);
}

.filter-group.is-hidden {
  display: none;
}

.filter-group.is-disabled {
  opacity: 0.6;
}

.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.flag-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.flag-media {
  background: var(--surface-2);
  padding: 0;
  display: grid;
  place-items: center;
  min-height: 140px;
}

.flag-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.flag-fallback {
  width: 100%;
  height: 140px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.06) 8px,
    rgba(255, 255, 255, 0.02) 8px,
    rgba(255, 255, 255, 0.02) 16px
  );
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: none;
  place-items: center;
  text-align: center;
}

.flag-card.is-missing .flag-fallback {
  display: grid;
}

.flag-info {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flag-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.flag-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flag-subtitle-right {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}

.result-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 16px 18px;
  border-radius: 16px;
}

.result-grid .info-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-grid .info-value {
  font-size: 1.05rem;
}

.info-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.info-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.info-icon i {
  font-size: 0.95rem;
}

.info-title {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.info-value {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-word;
}

.info-value .info-line {
  display: block;
  font-weight: 500;
}

.info-value .info-label {
  color: var(--muted);
  font-weight: 600;
}

.info-value a {
  color: var(--primary);
  text-decoration: none;
}

.info-value a:hover {
  text-decoration: underline;
}

.empty-state {
  margin: 14px 0 18px;
  padding: 28px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

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

.empty-state__icon {
  font-size: 1.6rem;
}

.empty-state__text {
  font-weight: 600;
}

.ip-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 24px;
}

.input-group--wide input {
  width: 100%;
  min-height: 48px;
}

.ip-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.field-label {
  color: var(--muted);
  font-weight: 600;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

input[type="number"] {
  width: 100%;
  height: 50px;
  padding: 14px 16px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

input[type="number"]:focus {
  outline: none;
  background: var(--bg);
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input[type="number"]::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

input[type="text"]:not(.main-search-input):not(.pill-input):not(#tool-search),
input[type="search"]:not(.main-search-input):not(#tool-search),
body textarea:not(.source-editor) {
  height: 50px;
  padding: 14px 16px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  outline: none;
}

body textarea:not(.source-editor) {
  resize: vertical;
  height: auto;
  min-height: 50px;
}

body textarea[readonly]:not(.source-editor) {
  resize: none;
}

input[type="text"]:not(.main-search-input):not(.pill-input):not(#tool-search):focus,
input[type="search"]:not(.main-search-input):not(#tool-search):focus,
body textarea:not(.source-editor):focus {
  background: var(--bg);
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Shared Checkbox Style - Chip Design
 * Modern chip-style checkbox with the following features:
 * - Button-like appearance with full area clickable
 * - Hidden native checkbox (display: none) for cleaner layout
 * - Animated check badge (✓) appears on the left when selected
 * - Smooth transitions with spring-like easing
 * - Primary color border and shadow on checked state
 * - Hover effect with subtle elevation
 * - Flexible layout with dynamic gap animation
 * Usage: Wrap <input type="checkbox"> and <span> label inside <label class="check">
 */
.check {
  position: relative;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  user-select: none;
  overflow: hidden;
  gap: 0;
}

.check input[type="checkbox"] {
  display: none;
}

.check span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  transition: all 0.2s;
  z-index: 2;
  padding: 0 4px;
}

/* Hover Effect */
.check:hover {
  background: var(--surface-1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Checked State */
.check:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb, 0,0,0), 0.15);
  gap: 8px;
}

.check:has(input:checked) span {
  color: var(--primary);
  font-weight: 700;
}

/* Left Check Badge - Animated ✓ icon */
.check::before {
  content: '✓';
  width: 0;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check:has(input:checked)::before {
  width: 20px;
  opacity: 1;
  transform: scale(1);
}

.primary-btn {
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  padding: 12px 28px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -1px rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.primary-btn:active {
  transform: translateY(0) scale(0.98);
}

.primary-btn:disabled,
.primary-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  pointer-events: none;
}

html[data-theme="light"] .primary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 8px 14px rgba(37, 99, 235, 0.25);
}

html[data-theme="light"] .primary-btn:hover {
  box-shadow: 0 12px 18px rgba(37, 99, 235, 0.35);
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ip-panel__right {
  display: grid;
  gap: 12px;
}

.summary-card {
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.summary-value {
  font-size: 1.1rem;
}

.summary-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

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

  .input-group {
    flex-direction: column;
  }
}
/* Enforcing Hero consistency */
#hero-title {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.2;
}

#hero-desc {
  font-size: 1.1rem;
  text-align: center;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  color: var(--muted);
}


/* --- MODERN INDEX REDESIGN --- */

.hero-section {
  padding: 0;
}

.hero-section::before {
  display: none;
}

.hero-content h2 {
  font-size: 3.2rem;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text) 30%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 500;
}

.search-container-lg {
  position: relative;
  max-width: 640px;
  margin: 48px auto 0;
}

.search-container-lg input {
  width: 100%;
  padding: 24px 28px 24px 72px;
  font-size: 1.2rem;
  border-radius: 99px;
  background: var(--surface-2); /* Slightly distinct from background */
  border: 2px solid transparent;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 10px 15px -3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text);
  font-weight: 500;
}

.search-container-lg input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.search-container-lg input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(var(--primary-rgb, 43, 108, 255), 0.15),
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.search-icon-lg {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--primary);
  pointer-events: none;
  transition: all 0.3s ease;
}

.search-container-lg input:focus + .search-icon-lg,
.search-container-lg:focus-within .search-icon-lg {
  color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

/* Category Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.index-count-display {
  margin-top: 32px;
  display: flex;
    align-items: center;
    justify-content: center;
}

.category-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 99px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-chip:hover {
  color: var(--text);
  background: rgba(var(--text-rgb), 0.05);
}

.category-chip.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--border);
}

/* Grid Modern */
.tool-grid-modern {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1200px) {
  .tool-grid-modern {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .tool-grid-modern {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tool-grid-modern {
    grid-template-columns: 1fr;
  }
}

.tool-card-modern {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  height: 100%;
  box-shadow: var(--shadow);
}

.tool-card-modern:hover {
  background: var(--primary);
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

.tool-icon-wrapper {
  border-radius: 18px;
  background: transparent;
  color: var(--primary);
  border: none;
  display: flex;
  font-size: 1.6rem;
  transition: all 0.3s ease;
  margin-bottom: 4px;
}

.tool-card-modern:hover .tool-icon-wrapper {
  background: transparent;
  color: var(--surface);
  border: none;
}

.tool-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-card-modern:hover .tool-info {
  filter: invert(1);
}

.tool-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.tool-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-action {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--surface);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.tool-card-modern:hover .card-action {
  opacity: 1;
  transform: translateX(0);
}

/* Disabled/Coming Soon Tool Cards */
.tool-card-modern.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  display: none;
}

.tool-card-modern.is-disabled:hover {
  transform: none;
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.tool-card-modern.is-disabled .card-action {
  opacity: 1;
  transform: translateX(0);
}

.tool-card-modern.is-disabled .card-action .badge {
  background: var(--chip);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  .hero-section {
    padding: 40px 20px;
  }
  .tool-grid-modern {
    grid-template-columns: 1fr;
  }

  /* ✨ Mobile Header Optimization */
  .site-header {
    padding: 16px 5vw;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .brand-site-name {
    font-size: 0.95rem;
  }

  .site-header .mobile-menu-btn {
    display: inline-flex !important;
    font-size: 1.5rem;
    padding: 8px;
    margin-left: auto; /* Push to right if needed, though flex handles it */
    color: var(--text);
  }

  .header-actions {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 24px 24px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(100%);
    z-index: 10002;
    gap: 16px;
    overflow-y: auto;
    border-left: 1px solid var(--border);
  }

  .header-actions.is-open {
    transform: translateX(0);
  }

  /* 사이드메뉴 내부 언어 선택 버튼 */
  .language-dropdown {
    width: 100%;
  }

  .language-dropdown__trigger {
    width: 100%;
  }

  .language-dropdown__menu {
    position: static;
    width: 100%;
    margin-top: 10px;
    max-height: 280px;
    box-shadow: none;
    border-radius: 12px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    display: none;
    gap: 2px;
  }

  .language-dropdown.is-open .language-dropdown__menu {
    display: flex;
  }

  .language-option {
    justify-content: space-between;
    border-radius: 8px;
  }

  #theme-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 12px;
    font-size: 1rem;
  }

  #theme-toggle::after {
    content: attr(data-theme-label);
    margin-left: 8px;
    font-weight: 600;
  }

  /* Backdrop Style */
  .menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
  }

  .menu-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* ✨ Hero Text Resizing - Mobile Optimized */
  .hero h2,
  .hero-section h2,
  #hero-title {
    font-size: 1.6rem !important; /* Force override ID selector */
    padding: 0 10px;
    word-break: keep-all;
    line-height: 1.3;
  }

  .hero p,
  .hero-section p,
  #hero-desc {
    font-size: 0.95rem !important; /* Force override ID selector */
    padding: 0 10px;
    word-break: keep-all;
    line-height: 1.5;
  }

  /* ✨ Japanese Language Word Break - Prevent horizontal scroll */
  html[lang="ja"] .hero h2,
  html[lang="ja"] .hero-section h2,
  html[lang="ja"] #hero-title {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  html[lang="ja"] .hero p,
  html[lang="ja"] .hero-section p,
  html[lang="ja"] #hero-desc {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* ✨ Global Japanese text wrapping for all content */
  html[lang="ja"] .tool-title,
  html[lang="ja"] .tool-desc,
  html[lang="ja"] h1,
  html[lang="ja"] h2,
  html[lang="ja"] h3,
  html[lang="ja"] h4,
  html[lang="ja"] p {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

