
:root {
    color-scheme: light dark;
    --bg: light-dark(#007f64,#00564a);
    --card: light-dark(#ffffff,#2a2a2a);
    --text: light-dark(#222,#ddd);
    --border: light-dark(#ccc,#444);
    --accent: #007f64;
    --field-w: 180px;      /* largeur standard, calée sur "Hong Kong (HKD)" */
    --amount-w: 126px;     /* champs de chiffres : -30% */
    --label-w: 90px;       /* colonne des labels Hammer / Premium / Sold */
    --ccy-w: 42px;         /* colonne de la devise hors case */
    --ccyfield-w: 64px;    /* case de la devise préférée (3 lettres) */
    --gap: 12px;
    /* largeur totale d'une ligne de calcul (pour centrage) */
    --row-w: calc(var(--label-w) + var(--ccy-w) + var(--amount-w) + var(--ccyfield-w) + var(--amount-w) + 4*var(--gap));
    --section-gap: 32px;   /* interligne titre→champs et date→Hammer */
}

/* GENERAL ------------------------------------------------------ */
body {
    font-family: "Akzidenz", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 24px;
}

.card {
    background: var(--card);
    padding: 24px;
    border-radius: 16px;
    max-width: 900px;
    margin: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

h1 {
    margin-bottom: var(--section-gap);
    text-align: center;
}

label {
    font-size: 16px;
    margin-bottom: 6px;
    display: block;
    font-weight: 700;
}

/* INPUTS -------------------------------------------------------- */
input, select, button {
    font-family: inherit;
}

input, select {
    width: var(--field-w);
    height: 42px;
    background: #e8e8e8;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 6px;
    font-size: 16px;
    box-sizing: border-box;
}

.field-input.active-field {
    background: #dceeff !important;
    border-color: #5aa3ff !important;
}

/* TOP ROW (Auction House / City / Date) — centrée --------------- */
.grid-top {
    display: grid;
    grid-template-columns: repeat(3, var(--field-w));
    gap: 20px;
    justify-content: center;
    margin-bottom: var(--section-gap);
}

/* CALC ROWS (Hammer / Premium / Sold) — centrées ----------------- */
.calc-rows-final {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.calc-row {
    display: grid;
    grid-template-columns: var(--label-w) var(--ccy-w) var(--amount-w) var(--ccyfield-w) var(--amount-w);
    gap: var(--gap);
    align-items: center;
}

.calc-row label {
    margin-bottom: 0;
}

/* Titre des deux colonnes de droite (devise préférée + montant) */
.calc-header {
    margin-bottom: -6px;
}

.calc-header .col-title {
    grid-column: 4 / 6;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
}

/* Titre mobile (affiché uniquement < 720px) */
.m-title {
    display: none;
}

/* Devise hors case */
.ccy-tag {
    font-weight: 700;
    color: light-dark(#555,#aaa);
    text-align: right;
}

/* Case grise : uniquement le montant */
.field-input {
    width: 100%;
    text-align: right;
}

/* Case grise de saisie de la devise préférée (ligne Hammer) */
.ccy-input {
    width: 100%;
    text-align: center;
    text-transform: uppercase;
}

/* Devise préférée en texte (lignes Premium / Sold) */
.pref-ccy {
    font-weight: 700;
    color: light-dark(#555,#aaa);
    text-align: center;
}

/* RESULT BOX (montants convertis) -------------------------------- */
.result-box {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: light-dark(#ffffff,#333);
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 16px;
    box-sizing: border-box;
}

/* ACTIONS : lien blondeau.ch + boutons sur la même ligne --------- */
.actions {
    width: var(--row-w);
    margin: var(--section-gap) auto 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.actions a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.actions a:hover {
    text-decoration: underline;
}

.buttons {
    display: flex;
    gap: 10px;
}

button {
    background: var(--accent);
    border: 0;
    padding: 10px 18px;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

/* ERROR ----------------------------------------------------------- */
.error-banner {
    color: #d9534f;
    background: #ffe6e6;
    border: 1px solid #d9534f;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 20px auto 0;
    width: var(--row-w);
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.4;
}

/* AUCTION TIME ---------------------------------------------------- */
.auction-time-form {
    max-width: calc(3*var(--field-w) + 40px);
    margin: auto;
}

.auction-time-pair {
    display: grid;
    grid-template-columns: repeat(2, var(--field-w));
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.auction-time .actions,
.auction-time .error-banner {
    width: 100%;
}

.auction-time .actions,
.auction-time .buttons {
    flex-wrap: wrap;
}

.auction-time .buttons {
    justify-content: flex-end;
}

.auction-time .input-error {
    border-color: #d9534f;
    background: #ffe6e6;
}

.auction-time-result {
    margin-top: var(--section-gap);
}

.auction-time-result h2 {
    font-size: 20px;
    text-align: center;
}

.auction-time-result h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.auction-time-result .auction-time-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auction-time-result .result-box {
    height: auto;
    min-height: 42px;
    padding: 8px 6px;
    justify-content: center;
    text-align: center;
}

/* MOBILE ---------------------------------------------------------- */
@media (max-width: 720px) {

    .grid-top {
        grid-template-columns: var(--field-w);
    }

    .calc-row {
        grid-template-columns: var(--label-w) var(--ccyfield-w) minmax(0, var(--amount-w));
        width: 100%;
        max-width: calc(var(--label-w) + var(--ccyfield-w) + var(--amount-w) + 2*var(--gap));
    }

    /* titre desktop masqué, titre mobile sous la ligne Hammer */
    .calc-header {
        display: none;
    }

    .m-title {
        display: block;
        grid-column: 1;
        grid-row: 2;
        font-weight: 700;
    }

    .calc-row > .ccy-input,
    .calc-row > .pref-ccy {
        grid-column: 2;
        grid-row: 2;
    }

    .calc-row > .ccy-tag,
    .calc-row > .pref-ccy {
        text-align: center;
    }

    .calc-row > .result-box {
        grid-column: 3;
        grid-row: 2;
    }

    .actions,
    .error-banner {
        width: auto;
    }

    .actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .auction-time-pair {
        grid-template-columns: var(--field-w);
    }

    .auction-time-result .auction-time-pair {
        grid-template-columns: minmax(0, 1fr);
    }

    .auction-time .buttons {
        justify-content: center;
    }
}
