/*
 * Melon Tools tool shell in the shadcn/ui "Maia" style (base color Stone, theme Emerald,
 * radius small): design tokens, top bar with breadcrumb, page hero and shared primitives.
 * Pages load Inter + Noto Sans, set data-theme="dark" on <html> for dark mode and
 * data-heading="noto" | "inter" to pick the heading font.
 */
:root {
  --m-page: #f5f5f4;
  --m-card: #ffffff;
  --m-fg: #0c0a09;
  --m-muted: #f5f5f4;
  --m-muted-fg: #79716b;
  --m-border: #e7e5e4;
  --m-input-bg: rgba(231, 229, 228, 0.3);
  --m-ring-line: rgba(12, 10, 9, 0.1);
  --m-primary: #007a55;
  --m-primary-hover: #006045;
  --m-primary-fg: #ecfdf5;
  --m-primary-soft: #ecfdf5;
  --m-primary-soft-fg: #006045;
  --m-focus: rgba(166, 160, 155, 0.5);
  --m-danger: #e7000b;
  --m-radius: 0.45rem;
  --m-radius-card: 13px;
  --m-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --m-font-heading: var(--m-font);
}

[data-theme="dark"] {
  --m-page: #0c0a09;
  --m-card: #1c1917;
  --m-fg: #fafaf9;
  --m-muted: #292524;
  --m-muted-fg: #a6a09b;
  --m-border: rgba(255, 255, 255, 0.1);
  --m-input-bg: rgba(255, 255, 255, 0.045);
  --m-ring-line: rgba(255, 255, 255, 0.1);
  --m-primary: #009966;
  --m-primary-hover: #007a55;
  --m-primary-fg: #ecfdf5;
  --m-primary-soft: rgba(0, 153, 102, 0.15);
  --m-primary-soft-fg: #5ee9b5;
  --m-focus: rgba(121, 113, 107, 0.6);
  --m-danger: #ff6467;
}

[data-heading="noto"] {
  --m-font-heading: "Noto Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.shell-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--m-border);
  background: color-mix(in srgb, var(--m-page) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--m-fg);
  font-family: var(--m-font);
  font-size: 14px;
}

.shell-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;
}

.shell-topbar--wide .shell-topbar-inner {
  max-width: 1440px;
}

.shell-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
}

.shell-crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--m-muted-fg);
  text-decoration: none;
  white-space: nowrap;
}

.shell-crumbs a:hover {
  color: var(--m-fg);
}

.shell-crumbs img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.shell-crumbs .shell-sep {
  color: var(--m-border);
}

.shell-crumbs > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ghost buttons in the top bar (also applied to tool buttons moved there). */
.shell-btn,
.shell-actions .mt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  min-width: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--m-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.shell-btn:hover,
.shell-actions .mt-button:hover,
.shell-actions .mt-button:focus-visible {
  background: var(--m-muted);
  color: var(--m-fg);
}

.shell-btn:focus-visible,
.shell-actions .mt-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--m-focus);
}

.shell-actions .history-btn {
  padding: 0 8px;
  font-size: 1.05rem;
}

.shell-hero {
  padding: 36px 0 24px;
  color: var(--m-fg);
  font-family: var(--m-font);
}

.shell-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--m-primary-soft);
  color: var(--m-primary-soft-fg);
  font-size: 12px;
  font-weight: 500;
}

.shell-hero h1 {
  margin: 14px 0 8px;
  font-family: var(--m-font-heading);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.shell-hero p {
  margin: 0;
  max-width: 62ch;
  color: var(--m-muted-fg);
  font-size: 16px;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .shell-topbar-inner {
    padding: 0 16px;
  }

  .shell-crumbs .shell-home-label,
  .shell-crumbs .shell-sep {
    display: none;
  }
}

/* ---------- Star rating (includes/ratings.php) ---------- */
.melon-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--m-muted-fg);
  font-size: 13px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.melon-rating-stars {
  position: relative;
  display: inline-block;
  color: var(--m-border);
  letter-spacing: 1px;
}

.melon-rating-stars span {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  color: #f5a524;
  white-space: nowrap;
}

.melon-rating strong {
  color: var(--m-fg);
  font-weight: 600;
}

.shell-hero .melon-rating {
  margin: 4px 0 8px;
}
