/* Cron Playground — styles */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light dark;

  --bg: #f5f6fb;
  --panel: #ffffff;
  --panel-2: #fbfbfe;
  --card: #f8f9fc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --accent-text: #4338ca;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b16;
    --panel: #0f1629;
    --panel-2: #0c1222;
    --card: #0d1426;
    --text: #e8ecf5;
    --muted: #94a3b8;
    --border: #1e2942;
    --border-strong: #2b3856;
    --accent: #818cf8;
    --accent-2: #a78bfa;
    --accent-soft: rgba(99, 102, 241, 0.16);
    --accent-text: #c7d2fe;
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.7);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

html,
body {
  margin: 0;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(600px 400px at 12% -8%, rgba(99, 102, 241, 0.16), transparent 70%),
    radial-gradient(700px 500px at 100% 0%, rgba(139, 92, 246, 0.12), transparent 70%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 32px;
}

/* Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

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

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 10px 24px -10px rgba(99, 102, 241, 0.85);
}

.logo svg {
  width: 26px;
  height: 26px;
}

h1 {
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 58ch;
}

.lang-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.lang-switch button:hover {
  color: var(--text);
  background: var(--card);
}

.lang-switch button.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(99, 102, 241, 0.9);
}

.lang-switch button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel h2 {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 700;
}

.panel h2.mt {
  margin-top: 26px;
}

/* Preset cards */

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

.preset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.preset code {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-text);
  word-break: break-word;
}

.preset span {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}

.preset:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.preset.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.preset:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

/* Input */

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

#cronInput {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#cronInput::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

#cronInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

#cronInput.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.field-hint {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

.field-hint #fieldHint {
  font-family: var(--mono);
}

.error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--border);
  padding: 9px 12px;
  border-radius: 10px;
}

.error .hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Buttons */

.btn {
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}

.btn.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 10px 22px -10px rgba(99, 102, 241, 0.8);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(99, 102, 241, 0.9);
}

.btn.ghost {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.btn.small {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

/* Results */

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.results-head h2 {
  margin: 0;
}

.tz-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex: none;
}

.tz-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tz-toggle button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tz-toggle button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.cron-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.09), rgba(139, 92, 246, 0.06));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px 12px 16px;
}

.cron-display code {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  min-width: 0;
}

.note {
  margin: 10px 2px 16px;
  font-size: 12px;
  color: var(--muted);
}

.runs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.runs li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  animation: row-in 0.25s ease both;
}

.runs li:nth-child(odd) {
  background: var(--card);
}

.runs.no-anim li {
  animation: none;
}

.runs li:last-child {
  border-bottom: 0;
}

.runs li.empty {
  display: block;
  text-align: center;
  color: var(--muted);
  padding: 22px;
  animation: none;
}

.run-idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.run-date {
  min-width: 0;
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-time {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.run-rel {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* wrangler.toml block */

.config {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel-2);
}

.config-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.config-head h3 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 650;
}

.config pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}

.config code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.6;
}

/* Footer + toast */

.site-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--accent-text);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer .dot {
  opacity: 0.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #0f172a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  z-index: 10;
  max-width: calc(100vw - 40px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: #e8ecf5;
    color: #0f172a;
  }
}

/* Responsive */

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

  .page {
    padding: 28px 16px 24px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 22px;
  }

  .site-header {
    gap: 14px;
  }

  .lang-switch {
    width: 100%;
    justify-content: space-between;
  }

  .lang-switch button {
    flex: 1;
  }

  .panel {
    padding: 18px;
    border-radius: 16px;
  }

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

  .cron-display {
    flex-wrap: wrap;
  }

  .runs li {
    grid-template-columns: 24px minmax(0, 1fr) auto;
  }

  .run-rel {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .config-head {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
