:root {
  --ink: #1a2332;
  --ink-soft: #4a5a6e;
  --ink-mute: #7a8a9c;
  --paper: #f0f4f8;
  --paper-2: #e4ecf4;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --line: rgba(26, 35, 50, 0.1);
  --accent: #0d7a6f;
  --accent-hover: #09655c;
  --accent-soft: rgba(13, 122, 111, 0.1);
  --danger: #b33a3a;
  --danger-soft: rgba(179, 58, 58, 0.08);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 12px 40px rgba(26, 35, 50, 0.06);
  --radius: 12px;
  --font: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", monospace;
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(13, 122, 111, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 5%, rgba(45, 90, 140, 0.1), transparent 50%),
    linear-gradient(165deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.page {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.page-wide {
  width: min(960px, calc(100% - 2rem));
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  animation: fade-up 0.55s ease both;
}

.nav-brand {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.nav-brand:hover {
  color: var(--accent-hover);
}

.nav-links {
  display: flex;
  gap: 0.35rem;
}

.nav-links a {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 8px;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.header {
  margin-bottom: 2rem;
  animation: fade-up 0.55s ease both;
}

.home-header {
  margin-bottom: 2.25rem;
}

.brand {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.tool-list {
  display: grid;
  gap: 0.85rem;
  animation: fade-up 0.55s ease 0.08s both;
}

.tool-link {
  display: grid;
  gap: 0.25rem;
  padding: 1.25rem 1.4rem;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tool-link:hover {
  border-color: rgba(13, 122, 111, 0.35);
  transform: translateY(-1px);
}

.tool-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tool-desc {
  font-size: 0.9rem;
  color: var(--ink-mute);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editor-shell {
  padding: 1.25rem 1.25rem 1.4rem;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade-up 0.55s ease 0.08s both;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.editor-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.editor-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.inline-field select {
  padding: 0.35rem 0.5rem;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.inline-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-mute);
  min-height: 1.2em;
}

.status[data-kind="ok"] {
  color: var(--accent);
}

.status[data-kind="err"] {
  color: var(--danger);
}

.editor {
  display: block;
  width: 100%;
  min-height: min(52vh, 420px);
  padding: 1rem 1.05rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.editor:hover {
  background: #eaf0f6;
}

.editor:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.editor-actions {
  margin-top: 1rem;
}

.color-preview {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 1.15rem;
  align-items: center;
  padding: 1.15rem 1.3rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade-up 0.55s ease 0.08s both;
}

.swatch {
  width: 112px;
  height: 112px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d7a6f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.color-preview-meta {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.picker-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.picker-field input[type="color"] {
  width: 2.4rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

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

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

@media (max-width: 520px) {
  .color-preview {
    grid-template-columns: 1fr;
  }

  .swatch {
    width: 100%;
    height: 96px;
  }
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lede {
  margin: 0;
  max-width: 36em;
  color: var(--ink-soft);
  font-size: 1rem;
}

.now {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade-up 0.55s ease 0.08s both;
}

.now-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.now-value {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#live-timestamp {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.now-datetime {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.panels {
  display: grid;
  gap: 1.25rem;
  animation: fade-up 0.55s ease 0.16s both;
}

@media (min-width: 720px) {
  .panels {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.panel {
  padding: 1.4rem 1.4rem 1.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hint {
  margin: 0 0 1.15rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input:hover {
  background: #eaf0f6;
}

.field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.datetime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.datetime-grid .field {
  margin-bottom: 0;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.25rem;
}

button {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

button:active {
  transform: scale(0.98);
}

.btn-primary {
  padding: 0.6rem 1.15rem;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  padding: 0.6rem 1.05rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.btn-secondary:hover {
  color: var(--ink);
  background: var(--paper);
}

.btn-ghost {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
}

.btn-ghost:hover {
  background: rgba(13, 122, 111, 0.18);
}

.btn-ghost.is-copied {
  color: var(--ink);
  background: var(--paper-2);
}

.result {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
  animation: fade-in 0.3s ease both;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-label {
  font-size: 0.8rem;
  color: var(--ink-mute);
  flex-shrink: 0;
}

.result-value {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.error {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  animation: fade-up 0.55s ease 0.24s both;
}

.footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-mute);
  max-width: 48em;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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