/**
 * Coin Wiki Layouts v1.4.0 — melt calculator widget styles.
 *
 * Self-contained: defines its own palette so the widget works on any page,
 * not only coin/hub pages where the theme CSS variables exist.
 * Mobile-first at 360px. 44px minimum touch targets.
 */

.cwl-mc {
    --cwl-mc-bg: #0b0c0e;
    --cwl-mc-surface: #101214;
    --cwl-mc-surface-2: #15171a;
    --cwl-mc-hairline: rgba(201, 162, 39, 0.18);
    --cwl-mc-text: #f5f1e8;
    --cwl-mc-muted: #a9a294;
    --cwl-mc-faint: #6f6a5d;
    --cwl-mc-gold: #c9a227;
    --cwl-mc-gold-deep: #a8861f;
    --cwl-mc-gold-dim: rgba(201, 162, 39, 0.12);
    --cwl-mc-danger: #e5484d;
    --cwl-mc-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

    background: var(--cwl-mc-surface);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 16px;
    color: var(--cwl-mc-text);
    font-family: var(--cwl-mc-sans);
    padding: 20px;
    max-width: 560px;
    margin: 0 auto;
    box-sizing: border-box;
}

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

/* Mode tabs */
.cwl-mc-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--cwl-mc-bg);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 12px;
    padding: 4px;
}

.cwl-mc-tab {
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cwl-mc-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.cwl-mc-tab.is-active {
    background: var(--cwl-mc-gold-dim);
    color: var(--cwl-mc-gold);
}

/* Fields */
.cwl-mc-field {
    margin-bottom: 20px;
}

.cwl-mc-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cwl-mc-muted);
    margin-bottom: 8px;
}

.cwl-mc-hint {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--cwl-mc-faint);
    margin-left: 6px;
}

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

.cwl-mc-row .cwl-mc-input {
    flex: 1;
    min-width: 0;
}

.cwl-mc-input {
    width: 100%;
    min-height: 48px;
    background: var(--cwl-mc-bg);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 12px;
    color: var(--cwl-mc-text);
    font-size: 17px;
    font-family: inherit;
    padding: 10px 14px;
}

.cwl-mc-input:focus {
    outline: none;
    border-color: var(--cwl-mc-gold);
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25);
}

.cwl-mc-input::placeholder {
    color: var(--cwl-mc-faint);
}

/* Segmented controls */
.cwl-mc-seg {
    display: flex;
    background: var(--cwl-mc-bg);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.cwl-mc-row .cwl-mc-seg {
    flex: 0 0 auto;
}

.cwl-mc-seg button {
    min-height: 44px;
    min-width: 48px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cwl-mc-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.cwl-mc-seg button.is-active {
    background: var(--cwl-mc-gold-dim);
    color: var(--cwl-mc-gold);
}

/* Primary action */
.cwl-mc-btn {
    display: block;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    background: var(--cwl-mc-gold);
    color: #0b0c0e;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin: 4px 0 20px;
}

.cwl-mc-btn:active {
    background: var(--cwl-mc-gold-deep);
}

/* Result */
.cwl-mc-result {
    background: var(--cwl-mc-surface-2);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.cwl-mc-result-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cwl-mc-muted);
    margin-bottom: 4px;
}

.cwl-mc-result-value {
    font-size: 44px;
    line-height: 1.15;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--cwl-mc-gold);
    margin-bottom: 12px;
}

.cwl-mc-breakdown {
    font-size: 14px;
    color: var(--cwl-mc-muted);
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

.cwl-mc-breakdown .cwl-mc-line {
    display: block;
}

.cwl-mc-asof {
    margin-top: 10px;
    font-size: 12px;
    color: var(--cwl-mc-faint);
}

.cwl-mc-note {
    font-size: 14px;
    color: var(--cwl-mc-faint);
    text-align: center;
    margin-bottom: 8px;
}

.cwl-mc-error {
    font-size: 14px;
    color: var(--cwl-mc-danger);
    text-align: center;
    margin-bottom: 12px;
}

.cwl-mc-foot {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--cwl-mc-hairline);
    font-size: 12px;
    color: var(--cwl-mc-faint);
    text-align: center;
    line-height: 1.5;
}

/* Coin lookup */
.cwl-mc-coinlist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    max-height: 320px;
    overflow-y: auto;
}

.cwl-mc-coinbtn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    width: 100%;
    text-align: left;
    background: var(--cwl-mc-bg);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 10px;
    color: var(--cwl-mc-text);
    font-size: 15px;
    font-family: inherit;
    padding: 10px 14px;
    cursor: pointer;
}

.cwl-mc-coinbtn:active {
    border-color: var(--cwl-mc-gold);
}

.cwl-mc-coinbtn .cwl-mc-coinmeta {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--cwl-mc-muted);
    font-variant-numeric: tabular-nums;
}

.cwl-mc-coinempty {
    font-size: 14px;
    color: var(--cwl-mc-faint);
    text-align: center;
    padding: 12px 0;
}

.cwl-mc-coinsel {
    background: var(--cwl-mc-surface-2);
    border: 1px solid var(--cwl-mc-hairline);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.cwl-mc-coinsel-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cwl-mc-coinsel-value {
    font-size: 40px;
    margin-bottom: 10px;
}

.cwl-mc-coinsel-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 14px;
    color: var(--cwl-mc-gold);
    text-decoration: none;
    min-height: 44px;
    line-height: 44px;
    padding: 0 8px;
}

/* Hide karat field unless gold is selected (JS toggles [hidden]) */
.cwl-mc [hidden] {
    display: none !important;
}

/* Slightly roomier on desktop */
@media (min-width: 480px) {
    .cwl-mc {
        padding: 28px;
    }

    .cwl-mc-result-value {
        font-size: 52px;
    }
}
