/**
 * 扩展小工具：天气时钟 / 专业计算器 / 老黄历
 * 统一使用方块卡片 + 100% 宽度，插入任意侧栏都不撑破布局。
 */

.lsw-weather,
.lsw-calc,
.lsw-almanac {
    --lsw-accent: #5fb878;
    --lsw-ink: #22312a;
    --lsw-muted: #8a9a92;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,34,24,.05), 0 10px 26px -20px rgba(15,34,24,.45);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    color: var(--lsw-ink);
}

.lsw-weather *,
.lsw-calc *,
.lsw-almanac * {
    box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* 天气时钟                                                            */
/* ------------------------------------------------------------------ */

.lsw-weather__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 8px;
}

.lsw-weather__head b {
    font-size: 14px;
}

.lsw-weather__city {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(95,184,120,.12);
    color: #3c8d59;
    font-size: 11px;
    white-space: nowrap;
}

.lsw-weather__clock {
    padding: 4px 14px 10px;
    text-align: center;
    background: linear-gradient(160deg, rgba(95,184,120,.12), rgba(95,184,120,0) 75%);
}

.lsw-weather__time {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    color: #1f2d26;
}

.lsw-weather__time small {
    font-size: 16px;
    font-weight: 500;
    color: #6b8a76;
    letter-spacing: 0;
}

.lsw-weather__date {
    margin-top: 2px;
    font-size: 12px;
    color: var(--lsw-muted);
}

.lsw-weather__body {
    display: grid;
    grid-template-columns: 52px 1fr;
    grid-template-rows: auto auto auto;
    align-items: center;
    gap: 2px 10px;
    padding: 6px 14px 10px;
}

.lsw-weather__icon {
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    border-radius: 12px;
    background: rgba(95,184,120,.10);
    color: #e2a52b;
    font-size: 26px;
}

.lsw-weather--rain .lsw-weather__icon { color: #4a90d9; background: rgba(74,144,217,.12); }
.lsw-weather--snow .lsw-weather__icon { color: #6ea8d8; background: rgba(110,168,216,.12); }
.lsw-weather--storm .lsw-weather__icon { color: #8a6bc8; background: rgba(138,107,200,.12); }
.lsw-weather--cloud .lsw-weather__icon { color: #7b96a8; background: rgba(123,150,168,.12); }

.lsw-weather__temp b {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.lsw-weather__temp span {
    margin-left: 2px;
    font-size: 12px;
    color: var(--lsw-muted);
}

.lsw-weather__desc {
    font-size: 13px;
    color: #4b5b53;
}

.lsw-weather__meta {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #eef2f0;
    font-size: 11px;
    color: var(--lsw-muted);
}

.lsw-weather__meta b {
    color: #4b5b53;
    font-weight: 600;
}

.lsw-weather__forecast {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 14px 10px;
}

.lsw-weather__day {
    padding: 7px 4px;
    border-radius: 8px;
    background: #f7faf8;
    text-align: center;
    font-size: 11px;
    color: #6b7c73;
    line-height: 1.6;
}

.lsw-weather__day i {
    display: block;
    color: #d9a23c;
    font-size: 15px;
}

.lsw-weather__day b {
    display: block;
    color: #22312a;
    font-size: 12px;
}

.lsw-weather__foot {
    display: flex;
    justify-content: space-between;
    padding: 7px 14px;
    border-top: 1px solid #f2f5f3;
    font-size: 10px;
    color: #a3b0a9;
}

.lsw-weather__foot button {
    border: 0;
    background: transparent;
    color: #5fb878;
    font: inherit;
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* 专业计算器                                                          */
/* ------------------------------------------------------------------ */

.lsw-calc__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px 6px;
}

.lsw-calc__head b {
    font-size: 14px;
}

.lsw-calc__head span {
    color: #b8c4bd;
    font-size: 11px;
    letter-spacing: 1px;
}

.lsw-calc__tabs {
    display: flex;
    gap: 4px;
    padding: 0 12px 8px;
}

.lsw-calc__tabs button {
    flex: 1;
    padding: 5px 0;
    border: 1px solid #e6ede9;
    border-radius: 7px;
    background: #fbfdfc;
    color: #6b7c73;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.lsw-calc__tabs button.is-on {
    border-color: rgba(95,184,120,.45);
    background: rgba(95,184,120,.12);
    color: #35804d;
    font-weight: 600;
}

.lsw-calc__panel {
    padding: 0 12px 12px;
}

.lsw-calc__panel[hidden],
.lsw-calc__keys[hidden],
.lsw-calc__history[hidden],
.lsw-calc__loan-result[hidden] {
    display: none !important;
}

.lsw-calc__screen {
    padding: 8px 10px;
    border-radius: 9px;
    background: #f3f7f4;
    text-align: right;
    min-height: 62px;
}

.lsw-calc__expr {
    min-height: 16px;
    color: #8a9a92;
    font-size: 12px;
    word-break: break-all;
}

.lsw-calc__result {
    color: #1f2d26;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-all;
    font-variant-numeric: tabular-nums;
}

.lsw-calc__keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 8px;
}

.lsw-calc__key {
    height: 34px;
    border: 1px solid #e6ede9;
    border-radius: 7px;
    background: #fff;
    color: #2a3a32;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background .12s ease, transform .08s ease;
}

.lsw-calc__key:hover { background: #f2f8f4; }
.lsw-calc__key:active { transform: scale(.96); }

.lsw-calc__key--op { color: #3c8d59; font-weight: 600; background: #f6faf7; }
.lsw-calc__key--fn,
.lsw-calc__key--const { color: #6b7c73; font-size: 12px; background: #fafcfb; }
.lsw-calc__key--danger { color: #c05a52; }
.lsw-calc__key--eq { grid-column: 1 / -1; background: #5fb878; border-color: #5fb878; color: #fff; font-weight: 700; }
.lsw-calc__key--eq:hover { background: #4ea86a; }

.lsw-calc__history {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e6ede9;
    max-height: 92px;
    overflow-y: auto;
    font-size: 11px;
    color: #8a9a92;
    line-height: 1.8;
}

.lsw-calc__history div {
    display: flex;
    justify-content: space-between;
}

.lsw-calc__history b { color: #2a3a32; }

.lsw-calc__form label {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
    color: #6b7c73;
}

.lsw-calc__form input {
    display: block;
    width: 100%;
    height: 32px;
    margin-top: 3px;
    padding: 0 9px;
    border: 1px solid #dfe7e3;
    border-radius: 7px;
    background: #fbfdfc;
    color: #22312a;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.lsw-calc__form input:focus {
    border-color: #5fb878;
    box-shadow: 0 0 0 2px rgba(95,184,120,.14);
}

.lsw-calc__seg {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.lsw-calc__seg button {
    flex: 1;
    padding: 5px 0;
    border: 1px solid #dfe7e3;
    border-radius: 7px;
    background: #fff;
    color: #6b7c73;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.lsw-calc__seg button.is-on {
    border-color: #5fb878;
    background: rgba(95,184,120,.12);
    color: #35804d;
    font-weight: 600;
}

.lsw-calc__submit {
    width: 100%;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #6bc98a, #4ea86a);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.lsw-calc__loan-result {
    margin-top: 10px;
    padding: 10px;
    border-radius: 9px;
    background: #f5faf7;
    border: 1px solid #e3f0e8;
    font-size: 12px;
    line-height: 1.9;
    color: #4b5b53;
}

.lsw-calc__loan-result .big {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #2f8a4d;
    line-height: 1.4;
}

.lsw-calc__loan-result b { color: #22312a; }

/* ------------------------------------------------------------------ */
/* 老黄历                                                              */
/* ------------------------------------------------------------------ */

.lsw-almanac {
    background: linear-gradient(180deg, #fffdf7, #fff);
    border: 1px solid #f0e6cf;
}

.lsw-almanac__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: linear-gradient(90deg, #c8453b, #a9342e);
    color: #fff;
}

.lsw-almanac__head b { font-size: 14px; letter-spacing: 1px; }
.lsw-almanac__head span { font-size: 11px; opacity: .9; }

.lsw-almanac__date {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 8px;
}

.lsw-almanac__day {
    font-size: 38px;
    font-weight: 700;
    line-height: 1;
    color: #b03a31;
    font-variant-numeric: tabular-nums;
}

.lsw-almanac__ym b {
    display: block;
    font-size: 14px;
    color: #3b3229;
}

.lsw-almanac__ym span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #9b8c79;
}

.lsw-almanac__term {
    margin-left: auto;
    padding: 3px 9px;
    border: 1px solid #e4c98e;
    border-radius: 999px;
    background: #fdf6e6;
    color: #a4762a;
    font-size: 11px;
    white-space: nowrap;
}

.lsw-almanac__lunar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 14px;
    padding: 9px 12px;
    border-radius: 9px;
    background: #fdf7ec;
    color: #7a5b32;
    font-size: 14px;
}

.lsw-almanac__lunar i { color: #c79b47; }
.lsw-almanac__lunar b { font-weight: 700; }

.lsw-almanac__festival {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 999px;
    background: #c8453b;
    color: #fff;
    font-size: 11px;
}

.lsw-almanac__gz {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 10px 14px 0;
    font-size: 11px;
    color: #8a7b68;
}

.lsw-almanac__gz b { color: #4a3d2c; font-weight: 600; }

.lsw-almanac__yiji {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 14px;
}

.lsw-almanac__yi,
.lsw-almanac__ji {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px;
    border-radius: 9px;
}

.lsw-almanac__yi { background: #f0f8f2; }
.lsw-almanac__ji { background: #fdf1ef; }

.lsw-almanac__yi > span,
.lsw-almanac__ji > span {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.lsw-almanac__yi > span { background: #4ea86a; }
.lsw-almanac__ji > span { background: #c05a52; }

.lsw-almanac__yi p,
.lsw-almanac__ji p {
    margin: 0;
    font-size: 11px;
    line-height: 1.7;
    color: #4b5b53;
    word-break: break-all;
}

.lsw-almanac__shen {
    position: absolute;
    top: -9px;
    right: -4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e9d6ab;
    color: #7a5b32;
    font-size: 10px;
}

.lsw-almanac__tip {
    margin: 0 14px 12px;
    font-size: 10px;
    color: #a89a86;
    line-height: 1.6;
}

@media (max-width: 420px) {
    .lsw-weather__time { font-size: 30px; }
    .lsw-weather__forecast { grid-template-columns: repeat(3, 1fr); }
    .lsw-calc__key { height: 32px; font-size: 13px; }
}
