.tn-tide-widget, .tn-tide-widget * { box-sizing: border-box; }
.tn-tide-widget { width: 100%; max-width: 880px; margin: 24px auto; padding: 24px; border: 1px solid var(--tn-tide-border, #d4e5e9); border-radius: 16px; background: var(--tn-tide-bg, #fff); color: var(--tn-tide-text, #17333e); line-height: 1.7; font-size: 16px; font-family: inherit; min-width: 0; }
.tn-tide-widget .tn-tide-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tn-tide-widget .tn-tide-title { margin: 0; padding: 0; font-size: 1.3em; line-height: 1.5; color: var(--tn-tide-text, #17333e); }
.tn-tide-widget .tn-tide-badge { padding: 3px 10px; border-radius: 20px; background: var(--tn-tide-badge-bg, #fff2cc); color: var(--tn-tide-badge-text, #644800); font-size: 12px; }
.tn-tide-widget .tn-tide-date { margin: 10px 0 16px; font-size: 13px; color: var(--tn-tide-muted, #526b75); }
.tn-tide-widget .tn-tide-chart-wrap { position: relative; height: 300px; width: 100%; min-width: 0; }
.tn-tide-widget .tn-tide-canvas { display: block; max-width: 100%; }
.tn-tide-widget .tn-tide-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.tn-tide-widget .tn-tide-summary-item { padding: 12px 14px; border-radius: 8px; background: var(--tn-tide-panel, #f1f8fa); min-width: 0; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-label { margin: 0; font-size: 13px; color: var(--tn-tide-muted, #526b75); }
.tn-tide-widget .tn-tide-value { margin: 4px 0 0; font-weight: 700; }
.tn-tide-widget .tn-tide-table-toggle { cursor: pointer; font-size: 14px; }
.tn-tide-widget .tn-tide-table-wrap { overflow-x: auto; }
.tn-tide-widget .tn-tide-table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.tn-tide-widget .tn-tide-th, .tn-tide-widget .tn-tide-td { border: 1px solid var(--tn-tide-border, #d4e5e9); padding: 5px 10px; text-align: left; }
.tn-tide-widget .tn-tide-note { padding: 12px 14px; background: var(--tn-tide-notice, #fff8e8); border-left: 3px solid var(--tn-tide-warning, #e5b348); font-size: 14px; margin: 16px 0; }
.tn-tide-widget .tn-tide-demo-note, .tn-tide-widget .tn-tide-disclaimer { margin: 12px 0 0; font-size: 12px; color: var(--tn-tide-muted, #526b75); overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-disclaimer { border-top: 1px solid var(--tn-tide-border, #d4e5e9); padding-top: 12px; }
.tn-tide-error, .tn-tide-widget .tn-tide-chart-error { color: var(--tn-tide-error, #9c3030); }
.tn-tide-widget .tn-tide-chart-error[hidden] { display: none; }
@media (max-width: 600px) {
    .tn-tide-widget { padding: 16px; margin: 16px auto; font-size: 15px; }
    .tn-tide-widget .tn-tide-summary { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .tn-tide-widget .tn-tide-chart-wrap { height: 250px; }
    .tn-tide-widget .tn-tide-title { font-size: 1.2em; }
}

/* v0.3.0: only the fishing-spot memo inside the tide widget. */
.tn-tide-widget .tn-tide-spot-memo { margin: 20px 0; padding: 16px; border: 1px solid var(--tn-tide-border, #d4e5e9); border-radius: 10px; background: var(--tn-tide-memo, #f8fbfc); min-width: 0; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-spot-title { margin: 0 0 10px; padding: 0; font-size: 1.05em; line-height: 1.5; color: var(--tn-tide-text, #17333e); }
.tn-tide-widget .tn-tide-spot-name { margin: 0 0 6px; font-weight: 700; }
.tn-tide-widget .tn-tide-spot-text { margin: 10px 0; font-size: 14px; }
.tn-tide-widget .tn-tide-spot-summary { margin: 12px 0; }

/* v0.4.0: API fallback/debug only, scoped to the tide widget. */
.tn-tide-widget .tn-tide-api-notice { margin: 12px 0; font-size: 12px; color: var(--tn-tide-muted, #526b75); overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-debug { margin-top: 16px; padding: 10px 12px; border: 1px dashed var(--tn-tide-border, #d4e5e9); font-size: 12px; color: var(--tn-tide-muted, #526b75); overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-debug-title { cursor: pointer; }
.tn-tide-widget .tn-tide-debug-list { margin: 8px 0 0; }
.tn-tide-widget .tn-tide-debug-row { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tn-tide-widget .tn-tide-debug-label { margin: 0; font-weight: 700; }
.tn-tide-widget .tn-tide-debug-value { margin: 0; }

/* v0.5.0: acquisition metadata only. */
.tn-tide-widget .tn-tide-acquired { margin: 10px 0; font-size: 12px; color: var(--tn-tide-muted, #526b75); overflow-wrap: anywhere; }

/* v0.7.0: presentation only, scoped to the tide card. */
.tn-tide-widget .tn-tide-section-title { margin: 22px 0 10px; padding: 0; color: var(--tn-tide-text, #17333e); font-size: 1em; line-height: 1.5; }
.tn-tide-widget .tn-tide-summary { margin: 10px 0 16px; }
.tn-tide-widget .tn-tide-summary-wide { grid-column: 1 / -1; }
.tn-tide-widget .tn-tide-primary .tn-tide-value { font-size: 1.05em; }
.tn-tide-widget .tn-tide-summary-wide .tn-tide-value { font-size: 14px; font-weight: 500; }
.tn-tide-widget .tn-tide-primary .tn-tide-summary-item { border: 1px solid var(--tn-tide-panel-border, #e1eef2); }
.tn-tide-widget .tn-tide-extra .tn-tide-summary-item { background: var(--tn-tide-extra, #f8fafb); padding: 10px 12px; }
.tn-tide-widget .tn-tide-extra .tn-tide-value { font-size: 14px; font-weight: 500; }
.tn-tide-widget .tn-tide-reference-note { margin: 10px 0 16px; color: var(--tn-tide-muted, #526b75); font-size: 12px; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-safety-memo { margin: 12px 0; padding: 12px; border-left: 3px solid var(--tn-tide-warning, #e5b348); border-radius: 4px; background: var(--tn-tide-notice, #fff8e8); font-size: 14px; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-details { margin: 12px 0; border: 1px solid var(--tn-tide-border, #d4e5e9); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tn-tide-widget .tn-tide-table-toggle { color: var(--tn-tide-link, #315866); line-height: 1.6; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-table-toggle:focus-visible, .tn-tide-widget .tn-tide-debug-title:focus-visible { outline: 2px solid var(--tn-tide-accent, #087f9c); outline-offset: 4px; }
.tn-tide-widget .tn-tide-debug { background: var(--tn-tide-debug-bg, #f4f6f8); color: var(--tn-tide-debug-text, #52616b); border-color: var(--tn-tide-debug-border, #cbd5dd); }
.tn-tide-widget .tn-tide-debug-row { padding: 5px 0; border-bottom: 1px solid var(--tn-tide-debug-line, #e0e6eb); }
.tn-tide-widget .tn-tide-debug-label { flex: 0 1 190px; }
.tn-tide-widget .tn-tide-debug-value { flex: 1 1 240px; min-width: 0; }
.tn-tide-widget .tn-tide-acquired { margin-bottom: 16px; }
@media (max-width: 600px) {
    .tn-tide-widget .tn-tide-section-title { margin-top: 18px; }
    .tn-tide-widget .tn-tide-summary-item { padding: 10px 12px; }
    .tn-tide-widget .tn-tide-spot-memo { padding: 12px; }
    .tn-tide-widget .tn-tide-debug-label, .tn-tide-widget .tn-tide-debug-value { flex-basis: 100%; }
}

/* v0.8.0: variables belong to each card, so themes can coexist on one page. */
.tn-tide-widget.tn-tide-theme-dark { --tn-tide-bg: #12212d; --tn-tide-text: #eef5fa; --tn-tide-muted: #b7c9d5; --tn-tide-border: #415867; --tn-tide-panel: #203544; --tn-tide-panel-border: #415867; --tn-tide-extra: #1b2d3b; --tn-tide-memo: #182b38; --tn-tide-notice: #3c321f; --tn-tide-warning: #e9bc64; --tn-tide-link: #a7d8ee; --tn-tide-accent: #77c9ec; --tn-tide-debug-bg: #1b2b37; --tn-tide-debug-text: #c1d2dd; --tn-tide-debug-border: #4a6272; --tn-tide-debug-line: #354c5c; --tn-tide-error: #ffb3b3; }
.tn-tide-widget.tn-tide-theme-light { --tn-tide-bg: #ffffff; --tn-tide-text: #223744; --tn-tide-muted: #536b79; --tn-tide-border: #d9e7f0; --tn-tide-panel: #f5faff; --tn-tide-panel-border: #e3edf5; --tn-tide-extra: #fafcfe; --tn-tide-memo: #f7fbff; --tn-tide-badge-bg: #e7f3ff; --tn-tide-badge-text: #234e70; --tn-tide-accent: #337faa; }
.tn-tide-widget.tn-tide-theme-green { --tn-tide-bg: #ffffff; --tn-tide-text: #213e30; --tn-tide-muted: #526c5d; --tn-tide-border: #cfe1d5; --tn-tide-panel: #edf7ef; --tn-tide-panel-border: #d7e8dc; --tn-tide-extra: #f5faf6; --tn-tide-memo: #f0f7f2; --tn-tide-badge-bg: #e0f0df; --tn-tide-badge-text: #315438; --tn-tide-link: #315b40; --tn-tide-accent: #358053; }
.tn-tide-widget.tn-tide-theme-mono { --tn-tide-bg: #ffffff; --tn-tide-text: #262626; --tn-tide-muted: #595959; --tn-tide-border: #d5d5d5; --tn-tide-panel: #f2f2f2; --tn-tide-panel-border: #dedede; --tn-tide-extra: #fafafa; --tn-tide-memo: #f7f7f7; --tn-tide-badge-bg: #e9e9e9; --tn-tide-badge-text: #383838; --tn-tide-notice: #efefef; --tn-tide-warning: #777777; --tn-tide-link: #444444; --tn-tide-accent: #555555; --tn-tide-debug-bg: #f3f3f3; --tn-tide-debug-text: #555555; --tn-tide-debug-border: #cccccc; --tn-tide-debug-line: #dedede; }
.tn-tide-widget .tn-tide-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--tn-tide-border, #d4e5e9); min-width: 0; }
.tn-tide-widget .tn-tide-logo { display: block; width: auto; height: auto; max-width: min(96px, 100%); max-height: 64px; object-fit: contain; flex: 0 1 auto; }
.tn-tide-widget .tn-tide-brand-text { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-brand-name { margin: 0; color: var(--tn-tide-text, #17333e); font-size: 1.05em; font-weight: 700; line-height: 1.5; }
.tn-tide-widget .tn-tide-subtitle { margin: 4px 0 0; color: var(--tn-tide-muted, #526b75); font-size: 12px; line-height: 1.6; }
/* Preserve the existing blue graph and legible axes, rather than changing Chart.js. */
.tn-tide-widget.tn-tide-theme-dark .tn-tide-chart-wrap { background: #ffffff; border-radius: 8px; }
.tn-tide-widget.tn-tide-layout-compact { padding: 12px; margin: 12px auto; font-size: 14px; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-summary { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-summary-item { padding: 8px 10px; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-section-title { margin-top: 16px; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-spot-memo { padding: 10px; margin: 14px 0; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-brand { gap: 8px; margin-bottom: 12px; padding-bottom: 10px; }
.tn-tide-widget.tn-tide-layout-compact .tn-tide-logo { max-width: min(72px, 100%); max-height: 48px; }

/* Dedicated simple view: only descendants of this widget. */
.tn-tide-widget.tn-tide-display-simple { padding: 16px; }
.tn-tide-widget.tn-tide-display-simple .tn-tide-summary { margin: 12px 0; gap: 8px; }
.tn-tide-widget.tn-tide-display-simple .tn-tide-summary-item { padding: 8px 12px; }
.tn-tide-widget.tn-tide-display-simple .tn-tide-simple-note { margin: 12px 0; padding: 10px 12px; }
.tn-tide-widget.tn-tide-display-simple .tn-tide-chart-wrap { height: 240px; }
@media (max-width: 600px) {
    .tn-tide-widget.tn-tide-display-simple .tn-tide-chart-wrap { height: 210px; }
}

.tn-tide-widget .tn-tide-observation { margin: 6px 0 10px; color: var(--tn-tide-muted, #526b75); font-size: 13px; overflow-wrap: anywhere; }
.tn-tide-widget .tn-tide-title { overflow-wrap: anywhere; min-width: 0; }

/* 1.1.2-dev fix: shared footer for all display modes. */
.tn-tide-widget .tn-tide-powered { font-size: 11px; text-align: right; color: var(--tn-tide-muted, #526b75); opacity: 0.65; margin: 8px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
