@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Patrick+Hand&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --paper: #faf6ed;          /* warm cream paper */
  --paper-alt: #f5efe0;
  --grid: rgba(60,90,120,.10); /* subtle blue-grey grid */
  --grid-major: rgba(60,90,120,.18);
  --ink: #1f2a44;            /* navy ink */
  --ink-light: #3d4a66;
  --ink-faint: #6b758a;
  --highlight: #ffe566;      /* highlighter yellow */
  --highlight-soft: rgba(255,229,102,.55);
  --red-pen: #d63b3b;
  --green-pen: #2f8f5e;
  --blue-pen: #2563aa;
  --border: rgba(60,90,120,.20);
  --border-strong: rgba(60,90,120,.35);
  --radius: 4px;
  --radius-md: 10px;
  --shadow: 0 1px 0 rgba(60,90,120,.10), 0 6px 14px rgba(60,90,120,.06);
  --shadow-md: 0 2px 0 rgba(60,90,120,.14), 0 14px 30px rgba(60,90,120,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--paper);
  background-image:
    /* graph paper grid: minor lines every 25px, major every 100px */
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 25px 25px, 25px 25px, 100px 100px, 100px 100px;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px;
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.65; min-height: 100vh;
}
.site-header {
  background: rgba(250,246,237,.96);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
  padding: 16px 18px; position: sticky; top: 0; z-index: 1000;
  width: 100%;
}
.site-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: 'Caveat', cursive;
  font-weight: 700; font-size: 32px; color: var(--ink);
  text-decoration: none; letter-spacing: -.5px; line-height: 1;
}
.brand-mark { color: var(--red-pen); }
.nav-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-tools a {
  font-family: 'Patrick Hand', cursive;
  font-size: 16px; color: var(--ink-light); text-decoration: none;
  padding: 4px 12px; white-space: nowrap;
  position: relative;
}
.nav-tools a:hover { color: var(--ink); }
.nav-tools a.active {
  color: var(--ink);
  background: linear-gradient(transparent 60%, var(--highlight) 60%, var(--highlight) 90%, transparent 90%);
}

.layout {
  max-width: 1200px; margin: 0 auto; padding: 28px 18px;
  display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 36px;
}
@media (max-width:760px) { .layout { grid-template-columns: minmax(0,1fr); gap: 24px; } }

.tool-page h1 {
  font-family: 'Caveat', cursive;
  font-size: 48px; font-weight: 700; margin: 0 0 12px;
  letter-spacing: -.5px; color: var(--ink); line-height: 1.05;
}
.tool-page h1::after {
  content: '';
  display: block; height: 12px; width: 80px;
  background: var(--highlight);
  margin-top: -8px; margin-left: 4px;
  position: relative; z-index: -1;
  transform: rotate(-1deg);
}
.tool-page .lead {
  font-family: 'Inter', sans-serif;
  color: var(--ink); font-size: 16px; margin: 0 0 20px; font-weight: 500;
}

.tool-card, .card {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 22px;
  position: relative;
  box-shadow: var(--shadow);
}
.tool-card h2, .card h2 {
  font-family: 'Caveat', cursive;
  font-size: 28px; margin: 0 0 16px; font-weight: 700; line-height: 1.1;
  color: var(--ink);
}

input[type="date"], input[type="time"], input[type="text"], input[type="number"], select {
  background: rgba(255,255,255,.8);
  color: var(--ink);
  border: 1.5px solid var(--ink-light);
  border-radius: var(--radius);
  padding: 10px 14px; font-size: 15px;
  font-family: 'Inter', sans-serif;
  width: 100%; transition: border-color .15s;
}
input:focus, select:focus { outline: 0; border-color: var(--red-pen); }

button.primary {
  background: var(--ink); color: var(--paper); border: 0;
  border-radius: var(--radius);
  padding: 12px 26px; font-size: 15px; font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer; transition: transform .12s, background .12s;
  position: relative; box-shadow: 3px 3px 0 var(--ink-light);
}
button.primary:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink-light); }
button.primary:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink-light); }
button.ghost {
  background: transparent; color: var(--ink); border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 16px; font-size: 14px; cursor: pointer; font-weight: 600;
  font-family: 'Inter', sans-serif; transition: background .12s;
}
button.ghost:hover { background: var(--highlight-soft); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label {
  font-family: 'Patrick Hand', cursive;
  font-size: 17px; color: var(--ink); font-weight: 400;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width:480px) { .field-row { grid-template-columns: 1fr; } }

/* Result */
.result, .result-box {
  background:
    repeating-linear-gradient(transparent, transparent 24px, var(--grid) 24px, var(--grid) 25px),
    rgba(255,253,245,.7);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 22px; margin: 18px 0; min-height: 60px;
  position: relative;
}
.result-big {
  font-family: 'Caveat', cursive;
  font-size: 56px; font-weight: 700; line-height: 1;
  color: var(--red-pen);
  letter-spacing: -.5px;
  display: inline-block;
  background: linear-gradient(transparent 60%, var(--highlight) 60%, var(--highlight) 90%, transparent 90%);
  padding: 0 8px;
}
.result-detail {
  font-family: 'Patrick Hand', cursive;
  color: var(--ink-light); font-size: 17px; margin-top: 12px;
}
.result-box h2 {
  font-family: 'Caveat', cursive;
  font-size: 36px; margin: 0 0 8px; color: var(--red-pen); font-weight: 700;
}

/* Timeline (planner) */
.timeline-card {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 22px; margin-bottom: 18px;
  overflow-x: auto;
}
.timeline-row {
  display: grid; grid-template-columns: 130px repeat(24,1fr); gap: 1px;
  align-items: center; min-width: 720px; margin-bottom: 5px;
}
.timeline-city {
  font-family: 'Patrick Hand', cursive;
  font-size: 16px; font-weight: 400; padding: 8px 10px;
  background: rgba(255,255,255,.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
}
.timeline-city .tz {
  display: block; font-size: 11px; color: var(--ink-faint);
  font-family: 'Inter', sans-serif;
  font-weight: 500; margin-top: 2px;
}
.timeline-cell {
  text-align: center; font-size: 12px; padding: 8px 2px;
  border-radius: 2px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--ink-light);
  background: rgba(255,255,255,.4);
}
.timeline-cell.good {
  background: var(--highlight);
  color: var(--ink);
}
.timeline-cell.ok {
  background: rgba(255,229,102,.35);
  color: var(--ink);
}
.timeline-cell.bad {
  background: transparent;
  color: var(--ink-faint);
}
.timeline-cell.now { outline: 2px solid var(--red-pen); }

.legend {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px;
  color: var(--ink-light); margin: 8px 0 16px;
  font-family: 'Patrick Hand', cursive;
}
.legend-dot {
  display: inline-block; width: 14px; height: 14px;
  vertical-align: middle; margin-right: 6px;
  border: 1px solid var(--ink); border-radius: 2px;
}
.legend-dot.good { background: var(--highlight); }
.legend-dot.ok { background: rgba(255,229,102,.35); }
.legend-dot.bad { background: transparent; }

.city-picker {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.city-chip {
  background: rgba(255,255,255,.7);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius); padding: 5px 12px; font-size: 14px;
  font-family: 'Patrick Hand', cursive;
  display: inline-flex; align-items: center; gap: 6px;
}
.city-chip button {
  background: transparent; border: 0; color: var(--red-pen);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
  font-weight: 700;
}
.city-chip button:hover { color: var(--ink); }
.add-city {
  background: var(--paper-alt); border: 1.5px dashed var(--ink-light);
  border-radius: var(--radius); padding: 5px 12px; font-size: 14px;
  cursor: pointer; color: var(--ink); font-family: 'Patrick Hand', cursive;
  margin: 4px;
}
.add-city:hover { background: var(--highlight); }

.share-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.copied-badge { color: var(--green-pen) !important; font-weight: 700; }
.share-input {
  background: rgba(255,255,255,.7);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'Inter', monospace; font-size: 12px;
  word-break: break-all; margin-top: 8px;
  color: var(--ink-light);
}

/* SEO blocks */
.seo-block, .info-box {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 24px 28px; margin: 24px 0;
  font-size: 15px; line-height: 1.8; color: var(--ink);
}
.seo-block h3, .info-box h2 {
  font-family: 'Caveat', cursive;
  font-size: 26px; color: var(--ink); margin: 0 0 10px; font-weight: 700;
}
.seo-block h3:not(:first-child), .info-box h3 { margin-top: 18px; }
.seo-block p, .info-box p { margin: 0 0 10px; }

/* Ads */
.ads-slot {
  background:
    repeating-linear-gradient(45deg, transparent, transparent 8px, var(--border) 8px, var(--border) 9px),
    rgba(255,253,245,.5);
  border: 1.5px dashed var(--ink-light);
  border-radius: var(--radius);
  padding: 22px; text-align: center; color: var(--ink-light);
  font-size: 13px; margin: 18px 0; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Patrick Hand', cursive;
}

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 84px;
}
@media (max-width:760px) { .sidebar { position: static; } }
.sidebar-card {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
}
.sidebar-card::before {
  content: '';
  position: absolute; top: -8px; right: 14px;
  width: 36px; height: 14px;
  background: var(--highlight);
  transform: rotate(-2deg);
  border-radius: 2px;
}
.sidebar-card h3, .sidebar h2 {
  font-family: 'Caveat', cursive;
  font-size: 22px; font-weight: 700; margin: 0 0 12px;
  color: var(--ink); letter-spacing: 0;
}
.tool-link, .tool-links a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px; border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  border: 1.5px solid transparent;
  transition: background .12s, border-color .12s;
}
.tool-link:hover, .tool-links a:hover {
  background: var(--highlight-soft);
  border-color: var(--ink-light);
}
.tool-link strong { font-weight: 700; font-size: 14px; font-family: 'Inter', sans-serif; }
.tool-link span {
  font-size: 13px; color: var(--ink-light);
  font-family: 'Patrick Hand', cursive;
}

/* Footer */
.site-footer, footer {
  background: transparent;
  border-top: 2px solid var(--ink);
  padding: 28px 16px; margin-top: 56px;
  text-align: center; font-size: 14px; color: var(--ink-light);
  font-family: 'Patrick Hand', cursive;
}
.site-footer a, footer a { color: inherit; }

/* Hero */
.hero {
  background:
    repeating-linear-gradient(transparent, transparent 22px, rgba(255,255,255,.5) 22px, rgba(255,255,255,.5) 23px),
    rgba(255,253,245,.85);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  color: var(--ink);
  padding: 56px 40px;
  text-align: left;
  margin-bottom: 32px;
  position: relative;
}
.hero::before {
  content: '⏰';
  position: absolute; top: 24px; right: 36px;
  font-size: 56px; opacity: .35;
}
.hero h1 {
  font-family: 'Caveat', cursive;
  font-size: 56px; margin: 0 0 14px; font-weight: 700;
  letter-spacing: -.5px; color: var(--ink); line-height: 1.1;
  display: inline;
  background: linear-gradient(transparent 65%, var(--highlight) 65%, var(--highlight) 92%, transparent 92%);
  padding: 0 8px;
}
.hero h1::after { display: none; }
.hero p {
  font-family: 'Inter', sans-serif;
  margin: 22px 0 0; font-size: 17px; color: var(--ink);
  font-weight: 500; line-height: 1.6;
}

/* Tool grid */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 16px; margin: 24px 0;
}
.tool-card-link {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 22px;
  text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow);
  position: relative;
}
.tool-card-link:hover {
  transform: translate(-2px,-2px) rotate(-.5deg);
  box-shadow: 5px 5px 0 var(--ink);
}
.tool-card-link:nth-child(2n):hover { transform: translate(-2px,-2px) rotate(.5deg); }
.tool-card-link .icon { font-size: 32px; line-height: 1; margin-bottom: 4px; }
.tool-card-link strong {
  font-family: 'Caveat', cursive;
  font-size: 22px; font-weight: 700;
}
.tool-card-link span {
  font-size: 13px; color: var(--ink-light);
  font-family: 'Patrick Hand', cursive;
}

/* Cities grid */
.cities-grid, .city-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 12px; margin: 16px 0;
}
.city-card {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  transition: transform .15s;
}
.city-card:hover { transform: translateY(-2px); }
.city-card.good {
  background: linear-gradient(135deg, var(--highlight), rgba(255,229,102,.6));
}
.city-card.ok { background: rgba(255,229,102,.35); }
.city-card.bad { background: rgba(255,253,245,.5); }
.city-card .name, .city-card h3 {
  font-family: 'Patrick Hand', cursive;
  font-weight: 400; font-size: 17px; margin: 0 0 4px; color: var(--ink);
}
.city-card .time, .city-card .city-time {
  font-family: 'Inter', sans-serif;
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink); margin: 4px 0;
}
.city-card .meta, .city-card .city-country, .city-card .city-status {
  font-family: 'Patrick Hand', cursive;
  font-size: 13px; color: var(--ink-light); margin: 2px 0;
}

.region-section, .city-group { margin: 24px 0; }
.region-section h3, .city-group h2 {
  font-family: 'Caveat', cursive;
  font-size: 28px; color: var(--ink);
  letter-spacing: 0; margin: 0 0 12px; font-weight: 700;
}

.breadcrumbs {
  font-family: 'Patrick Hand', cursive;
  font-size: 15px; color: var(--ink-light); margin-bottom: 16px;
}
.breadcrumbs a { color: var(--ink-light); text-decoration: none; }
.breadcrumbs a:hover { color: var(--red-pen); }
.breadcrumbs strong { color: var(--ink); font-weight: 400; }

.eyebrow {
  font-family: 'Patrick Hand', cursive;
  font-size: 14px; font-weight: 400; color: var(--red-pen);
  letter-spacing: 0; text-transform: none; margin: 0 0 6px;
}

/* Page-shell compat */
.page-shell, .site-shell {
  max-width: 1200px; margin: 0 auto; padding: 28px 18px;
  display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 36px;
}
@media (max-width:760px) { .page-shell, .site-shell { grid-template-columns: minmax(0,1fr); gap: 24px; } }
.content { min-width: 0; }

/* Form helpers */
.form-grid, .field-grid {
  display: grid; gap: 14px;
  grid-template-columns: 1fr 1fr; align-items: end; margin-bottom: 16px;
}
.field-grid.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width:480px) { .form-grid, .field-grid { grid-template-columns: 1fr; } }
.form-grid button.primary, .field-grid button.primary,
.form-grid button.ghost, .field-grid button.ghost { grid-column: 1 / -1; justify-self: stretch; }
.form-grid label, .field-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: 'Patrick Hand', cursive;
  font-size: 16px; color: var(--ink); font-weight: 400;
}
.form-grid label input, .form-grid label select,
.field-grid label input, .field-grid label select {
  background: rgba(255,255,255,.8);
  color: var(--ink);
  border: 1.5px solid var(--ink-light);
  border-radius: var(--radius);
  padding: 10px 14px; font-size: 15px;
  font-family: 'Inter', sans-serif;
}

/* Metric (salary, etc) */
.metric {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px dashed var(--border-strong);
}
.metric:last-child { border-bottom: 0; }
.metric span {
  color: var(--ink-light); font-size: 15px;
  font-family: 'Patrick Hand', cursive;
}
.metric strong {
  font-weight: 700; font-size: 17px; color: var(--ink);
  font-family: 'Inter', sans-serif;
}

.error-text {
  color: var(--red-pen); font-size: 14px; margin-top: 8px;
  font-family: 'Patrick Hand', cursive;
}

/* KV list */
.kv-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
  margin-top: 14px; font-size: 14px;
}
.kv-list .k { color: var(--ink-light); font-family: 'Patrick Hand', cursive; }
.kv-list .v { font-weight: 700; color: var(--ink); }

/* Decorative red pen underline for headings */
.tool-card h2::after, .card h2::after {
  content: ''; display: block; height: 2px; width: 60px;
  background: var(--red-pen); margin-top: 4px; border-radius: 2px;
  transform: rotate(-1deg);
}

/* Mobile nav-tools horizontal scroll */
@media (max-width: 760px) {
  .site-header-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .nav-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0;
    padding-right: 4px;
    flex: 1;
    min-width: 0;
  }
  .nav-tools::-webkit-scrollbar { display: none; }
  .nav-tools a {
    flex-shrink: 0;
    font-size: 14px;
    padding: 4px 10px;
  }
  .brand {
    flex-shrink: 0;
    font-size: 26px;
  }
  .tool-page h1 { font-size: 36px; }
  .hero h1 { font-size: 38px; }
  .result-big { font-size: 40px; }
}

/* Universal h1 / h2 styling for pages without .tool-page wrapper */
.content h1, main > h1, main h1:not(.tool-page h1) {
  font-family: "Caveat", cursive;
  font-size: 48px; font-weight: 700; margin: 0 0 12px;
  letter-spacing: -.5px; color: var(--ink); line-height: 1.05;
}
.content h2, main h2:not(.tool-card h2):not(.card h2) {
  font-family: "Caveat", cursive;
  font-size: 28px; line-height: 1.1;
}
@media (max-width:760px) {
  .content h1, main > h1 { font-size: 36px; }
}

/* User request: remove right sidebar (다른 도구) */
.sidebar { display: none !important; }
.layout, .page-shell, .site-shell { grid-template-columns: minmax(0,1fr) !important; }
@media (max-width: 760px) {
  .layout, .page-shell, .site-shell { grid-template-columns: minmax(0,1fr) !important; }
}

/* Mobile box / input overflow fixes */
@media (max-width: 760px) {
  .tool-card, .card { padding: 18px; }
  input, select, textarea { max-width: 100%; box-sizing: border-box; }
  .timeline-row { min-width: 600px; }
  .city-chip { font-size: 13px; padding: 4px 10px; }
  .hero { padding: 36px 20px; }
  .hero h1 { font-size: 36px; }
  .tool-page h1 { font-size: 32px; }
  .seo-block, .info-box { padding: 18px 20px; font-size: 14px; }
  .seo-block h3, .info-box h2 { font-size: 22px; }
  .nav-tools a { font-size: 14px; padding: 4px 8px; }
}

/* Force html/body to allow sticky */
html, body { overflow-x: clip; }

/* === Layout normalization === */
main > article.tool-card {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.tool-card > section,
.tool-card > .form-grid,
.tool-card > .result-box,
.tool-card > .info-box,
.tool-card > .ads-slot {
  margin-bottom: 18px;
}
section.form-grid, .tool-card > .form-grid {
  background: rgba(255,253,245,.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 22px !important;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.breadcrumbs { display: block; }
.eyebrow { display: block; margin: 0 0 6px; }
article > h1, .tool-card > h1 {
  font-family: "Caveat", cursive;
  font-size: 44px; line-height: 1.05;
  margin: 0 0 12px;
}
@media (max-width: 760px) {
  article > h1, .tool-card > h1 { font-size: 34px; }
}

/* Korean word-break: never split mid-word */
h1, h2, h3, h4, h5, h6, .lead, .eyebrow, .breadcrumbs, .seo-block, .info-box, .result, .result-box, .tool-card-link, .badge, .legend, .city-card, .metric span, .metric strong, button, p {
  word-break: keep-all;
  overflow-wrap: break-word;
}
