:root {
    --page-bg: #f6f5f4;
    --surface: #ffffff;
    --surface-soft: #fbfaf8;
    --text: rgba(0, 0, 0, 0.92);
    --muted: #615d59;
    --muted-light: #8a8580;
    --border: rgba(0, 0, 0, 0.10);
    --border-strong: rgba(0, 0, 0, 0.16);
    --notion-blue: #0075de;
    --notion-blue-dark: #005bab;
    --badge-blue-bg: #f2f9ff;
    --success: #1f9d55;
    --success-soft: #eefaf3;
    --danger: #d94841;
    --danger-soft: #fff2f0;
    --gold: #d89917;
    --gold-soft: #fff7df;
    --purple: #7657d7;
    --purple-soft: #f4f0ff;
    --shadow-card: rgba(0, 0, 0, 0.04) 0 4px 18px, rgba(0, 0, 0, 0.027) 0 2px 8px, rgba(0, 0, 0, 0.02) 0 1px 3px;
    --shadow-deep: rgba(0, 0, 0, 0.01) 0 1px 3px, rgba(0, 0, 0, 0.02) 0 3px 7px, rgba(0, 0, 0, 0.02) 0 7px 15px, rgba(0, 0, 0, 0.04) 0 14px 28px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 5%, rgba(255, 210, 90, 0.26), transparent 30%),
        radial-gradient(circle at 85% 8%, rgba(118, 87, 215, 0.13), transparent 26%),
        linear-gradient(180deg, #fffdf8 0%, var(--page-bg) 42%, #f2f0ed 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    line-height: 1.5;
}

button,
input,
.dropdown-menu {
    font-family: inherit;
}

.app-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.hero-card,
.panel,
.score-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
}

.hero-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 144px;
    padding: 20px 34px;
    border-radius: 24px;
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: auto -90px -150px auto;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 198, 41, 0.33), rgba(255, 198, 41, 0.02) 68%);
    pointer-events: none;
}

.hero-copy {
    position: relative;
    display: grid;
    justify-items: start;
    max-width: 680px;
    z-index: 1;
}

.eyebrow,
.panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--notion-blue);
    background: var(--badge-blue-bg);
    border: 1px solid rgba(0, 117, 222, 0.12);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-copy h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--text);
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
}

.hero-title-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    color: var(--notion-blue);
    background: linear-gradient(145deg, #fff, var(--gold-soft));
    border: 1px solid rgba(216, 153, 23, 0.22);
    border-radius: 16px;
    box-shadow: rgba(216, 153, 23, 0.10) 0 8px 18px;
}

.hero-title-icon svg {
    display: block;
    width: 39px;
    height: 39px;
    overflow: visible;
}

.hero-speaker-horn {
    fill: url(#heroSpeakerHorn);
    stroke: #f0b069;
    stroke-width: 2.7;
    stroke-linejoin: round;
}

.hero-speaker-mouth,
.hero-speaker-handle {
    fill: url(#heroSpeakerBlue);
    stroke: rgba(0, 117, 222, 0.18);
    stroke-width: 1.6;
    stroke-linejoin: round;
}

.hero-speaker-wave {
    fill: none;
    stroke: var(--notion-blue);
    stroke-width: 3.8;
    stroke-linecap: round;
}

.hero-speaker-wave-outer {
    opacity: 0.48;
}

.hero-speaker-spark {
    fill: #f04466;
    stroke: #ffb36d;
    stroke-width: 1.2;
    stroke-linejoin: round;
}

.hero-copy p {
    margin: 18px 0 0;
    max-width: 580px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 500;
}

.lottery-entry {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    min-width: 176px;
    padding: 14px 16px;
    color: var(--text);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 223, 0.86)),
        #fff;
    border: 1px solid rgba(216, 153, 23, 0.24);
    border-radius: 24px;
    box-shadow: var(--shadow-deep);
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.lottery-entry:hover,
.lottery-entry:focus-visible {
    border-color: rgba(216, 153, 23, 0.42);
    box-shadow: rgba(0, 0, 0, 0.01) 0 1px 3px, rgba(0, 0, 0, 0.03) 0 8px 20px, rgba(216, 153, 23, 0.15) 0 16px 38px;
    transform: translateY(-2px);
}

.lottery-entry-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    border-radius: 22px;
    background: #fff;
    border: 1px solid var(--border);
}

.lottery-entry-icon img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.lottery-entry-copy {
    display: grid;
    gap: 4px;
}

.lottery-entry-copy strong {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.lottery-entry-copy small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.score-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 120px;
    padding: 20px;
    border-radius: 20px;
}

.score-card::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -46px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    opacity: 0.20;
}

.score-card-chance::after {
    background: #62aef0;
}

.score-card-coin::after {
    background: #ffd24d;
}

.score-card-extra::after {
    background: #9b7cff;
}

.score-card-cash::after {
    background: #35b77a;
}

.score-icon-wrap {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    border-radius: 22px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.band-img {
    display: block;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    object-fit: contain;
}

.gold-icon {
    object-fit: cover;
}

.score-content {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 0;
}

.score-label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.band-text {
    display: block;
    color: var(--text);
    font-size: clamp(42px, 5vw, 58px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.06em;
}

.score-helper {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}

.panel {
    border-radius: 22px;
    padding: 24px;
}

.action-panel,
.history-panel {
    display: flex;
    flex-direction: column;
}

.action-panel {
    height: 919px;
    min-height: 0;
}

.history-panel {
    height: auto;
    min-height: 0;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.panel-kicker {
    margin-bottom: 8px;
    padding: 3px 8px;
    font-size: 11px;
}

.panel-chip {
    white-space: nowrap;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}

.control-block + .control-block {
    margin-top: 18px;
}

.control-label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.segmented-control-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 52px;
    margin: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.segment-icon {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    object-fit: contain;
}

.segment-label:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--border);
}

.btn-check:focus + .segment-label,
.btn-check:focus-visible + .segment-label,
.form-control:focus,
.btn:focus-visible {
    outline: 3px solid rgba(9, 127, 232, 0.18);
    box-shadow: 0 0 0 1px rgba(9, 127, 232, 0.34);
}

.btn-check:checked + .segment-label {
    color: var(--text);
    background: #fff;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
    transform: translateY(-1px);
}

.btn-check:checked + .segment-label.positive {
    color: #116737;
    background: var(--success-soft);
    border-color: rgba(31, 157, 85, 0.22);
}

.btn-check:checked + .segment-label.negative {
    color: #a62d28;
    background: var(--danger-soft);
    border-color: rgba(217, 72, 65, 0.22);
}

.record-input-group {
    align-items: stretch;
    gap: 8px;
}

.record-input-group > .btn,
.record-input-group > .form-control {
    min-height: 46px;
    border-radius: 12px !important;
}

.reason-toggle,
.number-stepper,
.secondary-action {
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    font-weight: 800;
}

.reason-toggle:hover,
.number-stepper:hover,
.secondary-action:hover {
    color: var(--text);
    background: #fff;
    border-color: var(--border-strong);
}

.reason-input {
    min-width: min(260px, 100%);
}

.amount-input {
    max-width: 112px;
    text-align: center;
    font-weight: 800;
}

.form-control {
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--border);
    font-weight: 600;
}

.form-control:disabled {
    color: var(--muted);
    background-color: #f1efec;
    opacity: 1;
}

.form-control::placeholder {
    color: #a39e98;
}

.reason-menu {
    width: min(360px, calc(100vw - 48px));
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-deep);
}

.reason-menu .dropdown-item {
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    font-weight: 700;
    white-space: normal;
}

.reason-menu .dropdown-item:hover,
.reason-menu .dropdown-item:focus {
    color: var(--notion-blue);
    background: var(--badge-blue-bg);
}

.form-hint {
    margin: 9px 0 0;
    color: var(--muted-light);
    font-size: 13px;
}

.rule-control {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.rule-grid-buttons {
    display: grid;
    gap: 14px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.rule-button-group {
    display: grid;
    gap: 8px;
}

.rule-group-title,
.rule-detail-title,
.preview-kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.rule-button-list,
.rule-detail-grid,
.lottery-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.rule-button-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rule-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.rule-choice,
.rule-detail-choice,
.lottery-quick {
    min-height: 68px;
    padding: 10px 14px;
    text-align: left;
    color: var(--text);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: rgba(35, 31, 26, 0.03) 0 6px 14px;
    touch-action: manipulation;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.rule-choice:hover,
.rule-detail-choice:hover,
.lottery-quick:hover,
.rule-choice.is-selected,
.rule-detail-choice.is-selected,
.lottery-quick.is-selected {
    background: #fff;
    border-color: rgba(216, 153, 23, 0.36);
    box-shadow: rgba(216, 153, 23, 0.14) 0 12px 24px;
    transform: translateY(-1px);
}

.rule-choice strong,
.rule-detail-choice strong,
.lottery-quick {
    display: block;
    font-size: 16px;
    font-weight: 850;
    line-height: 1.18;
}

.rule-choice span,
.rule-detail-choice span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.rule-detail-panel {
    margin-top: 12px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.rule-detail-title {
    margin-bottom: 10px;
}

.manual-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.52fr);
    gap: 10px;
    align-items: stretch;
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.manual-amount-row {
    display: grid;
    grid-template-columns: 64px minmax(120px, 1fr) 64px;
    gap: 10px;
    align-items: stretch;
}

.manual-amount-row .number-stepper,
.manual-amount-row .amount-input,
.manual-entry .reason-input {
    min-height: 52px;
    font-size: 18px;
}

.manual-amount-row .amount-input {
    max-width: none;
}

.record-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 18px;
    row-gap: 4px;
    margin-top: 14px;
    padding: 14px 16px;
    background: linear-gradient(145deg, #fff, #fff8df);
    border: 1px solid rgba(216, 153, 23, 0.24);
    border-radius: 18px;
}

.record-preview.is-empty {
    background: var(--surface-soft);
    border-color: var(--border);
}

.record-preview.is-loading {
    opacity: 0.78;
}

.preview-kicker {
    grid-column: 1 / -1;
}

.preview-reason {
    color: var(--text);
    font-size: 18px;
    font-weight: 850;
    line-height: 1.25;
}

.preview-calc {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.preview-result {
    grid-column: 2;
    grid-row: 2 / 4;
    color: var(--notion-blue);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.lottery-copy {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
}

.lottery-field-label {
    display: block;
    margin: 12px 0 8px;
    color: var(--text);
    font-size: 15px;
    font-weight: 850;
}

.lottery-quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lottery-quick {
    text-align: center;
    font-size: 22px;
}

.lottery-amount-row {
    margin-top: 14px;
}

.primary-action:disabled,
.primary-action:disabled:hover {
    color: rgba(255, 255, 255, 0.78);
    background: #93bce0;
    border-color: #93bce0;
    box-shadow: none;
    cursor: not-allowed;
}

.action-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.primary-action {
    min-height: 56px;
    padding: 12px 22px;
    color: #fff;
    background: var(--notion-blue);
    border: 1px solid var(--notion-blue);
    border-radius: 12px;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(0, 117, 222, 0.18);
}

.primary-action:hover,
.primary-action:focus {
    color: #fff;
    background: var(--notion-blue-dark);
    border-color: var(--notion-blue-dark);
}

.history-panel {
    padding-bottom: 16px;
}

.history-page-shell {
    width: min(960px, calc(100% - 32px));
}

.history-page-panel {
    min-height: calc(100vh - 64px);
}

.history-page-panel .panel-heading h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.history-page-panel .list-log {
    height: calc(100vh - 290px);
    min-height: 320px;
}

.history-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.history-total-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 78px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: rgba(0, 0, 0, 0.025) 0 2px 10px;
}

.history-total-card::after {
    content: "";
    position: absolute;
    top: -28px;
    right: -28px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    opacity: 0.18;
    pointer-events: none;
}

.history-total-card-chance::after {
    background: #62aef0;
}

.history-total-card-coin::after {
    background: #ffd24d;
}

.history-total-card-extra::after {
    background: #9b7cff;
}

.history-total-card-cash::after {
    background: #35b77a;
}

.history-total-icon {
    position: relative;
    z-index: 1;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 4px;
    object-fit: contain;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.history-total-icon-coin {
    object-fit: cover;
}

.history-total-copy {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 0;
}

.history-total-label {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-total-number {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    color: var(--text);
    white-space: nowrap;
}

.history-total-number strong {
    overflow: hidden;
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.05em;
    text-overflow: ellipsis;
}

.history-total-number small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.history-total-error {
    margin: -8px 0 12px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
}

.history-empty,
.history-error {
    margin: 0;
    padding: 28px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.history-empty {
    list-style: none;
}

.history-error {
    color: var(--danger);
    background: var(--danger-soft);
    border-radius: 14px;
}

.history-heading {
    margin-bottom: 16px;
}

.list-log {
    display: grid;
    gap: 10px;
    flex: none;
    height: 520px;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px 20px 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: hidden;
}

.list-log::-webkit-scrollbar {
    width: 8px;
}

.list-log::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

.list-log .list-group-item {
    border: 0;
}

.log-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 78px;
    padding: 14px !important;
    background: #fff;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: rgba(0, 0, 0, 0.025) 0 2px 10px;
}

.log-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.log-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: linear-gradient(145deg, #edf7ff, #ffffff);
    font-size: 21px;
}

.log-icon-img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: contain;
}

.log-item.coin .log-icon-img {
    object-fit: cover;
}

.log-item.coin .log-icon {
    background: linear-gradient(145deg, #fff7dc, #ffffff);
}

.log-item.extra .log-icon {
    background: linear-gradient(145deg, #fff1c6, #ffffff);
}

.log-item.cash .log-icon {
    background: linear-gradient(145deg, #e5fbef, #ffffff);
}

.log-copy {
    min-width: 0;
}

.log-reason {
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-time {
    margin-top: 2px;
    color: var(--muted-light);
    font-size: 12px;
    font-weight: 600;
}

.log-amount-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.log-amount {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 138px;
    padding: 8px 10px;
    color: var(--muted);
    background: var(--success-soft);
    border: 1px solid rgba(31, 157, 85, 0.16);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.log-amount-group .log-amount {
    min-width: 128px;
}

.log-amount.is-negative,
.log-item.is-negative .log-amount:not(.is-positive) {
    background: var(--danger-soft);
    border-color: rgba(217, 72, 65, 0.16);
}

.log-amount strong {
    color: var(--success);
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.log-amount.is-negative strong,
.log-item.is-negative .log-amount:not(.is-positive) strong {
    color: var(--danger);
}

.rules-panel {
    margin-top: 18px;
}

.rules-heading {
    margin-bottom: 18px;
}

.rules-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 16px;
    align-items: start;
}

.rule-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.rule-card::before {
    content: "";
    position: absolute;
    top: -70px;
    right: -70px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    opacity: 0.15;
    pointer-events: none;
}

.rule-card-chance::before {
    background: #62aef0;
}

.rule-card-coin::before {
    background: #ffd24d;
}

.rule-card-title {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.rule-card-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.rule-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: contain;
}

.rule-list {
    position: relative;
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 1.35rem;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.65;
}

.rule-list li::marker {
    color: var(--notion-blue);
    font-weight: 900;
}

.rule-list strong {
    color: var(--text);
    font-weight: 850;
}

.custom-alert {
    position: relative;
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-deep);
}

.custom-alert.toast-error {
    color: #7a241f;
    background-color: var(--danger-soft);
    border-color: rgba(217, 72, 65, 0.18);
}

.custom-alert.toast-success {
    color: #14532d;
    background-color: var(--success-soft);
    border-color: rgba(31, 157, 85, 0.22);
}

#toast-text {
    display: grid;
    gap: 3px;
    white-space: normal;
}

.toast-title {
    color: inherit;
    font-size: 13px;
    font-weight: 850;
}

.toast-main {
    font-size: 22px;
    font-weight: 950;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.toast-positive {
    color: var(--success);
}

.toast-negative {
    color: var(--danger);
}

.toast-sub {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.reward-modal {
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-deep);
}

.reward-modal .modal-header,
.reward-modal .modal-footer {
    border-color: var(--border);
}

.reward-modal .modal-title {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.reward-modal .modal-body {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}

.lottery-entry:disabled,
.lottery-entry:disabled:hover {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-card);
}

.lottery-animation-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 1090;
    padding: 24px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.lottery-animation-overlay.is-visible {
    opacity: 1;
    transform: scale(1);
}

.lottery-animation-card {
    display: grid;
    place-items: center;
    width: min(360px, 72vw);
    aspect-ratio: 1 / 1;
    padding: 18px;
    background:
        radial-gradient(circle at 28% 20%, rgba(255, 210, 90, 0.35), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 216, 0.94));
    border: 1px solid rgba(216, 153, 23, 0.22);
    border-radius: 34px;
    box-shadow: rgba(35, 31, 26, 0.2) 0 24px 70px;
}

.lottery-animation-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 24px;
}

.lottery-dialog {
    width: min(820px, calc(100vw - 32px));
    max-width: min(820px, calc(100vw - 32px));
}

.lottery-modal-content {
    overflow: hidden;
    max-height: calc(100vh - 24px);
    background:
        radial-gradient(circle at 14% 8%, rgba(255, 210, 90, 0.24), transparent 30%),
        radial-gradient(circle at 92% 4%, rgba(98, 174, 240, 0.16), transparent 24%),
        rgba(255, 255, 255, 0.96);
}

.lottery-game-header {
    align-items: flex-start;
    gap: 14px;
}

.lottery-game-header .btn-close {
    margin-top: 6px;
}

.lottery-game-body {
    display: grid;
    gap: 14px;
    overflow-y: auto;
}

.lottery-game-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(330px, 0.9fr);
    gap: 14px;
    align-items: stretch;
}

.lottery-game-meter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.lottery-game-meter > div,
.lottery-multiplier-panel,
.lottery-status {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: rgba(35, 31, 26, 0.025) 0 5px 14px;
}

.lottery-game-meter > div {
    display: grid;
    gap: 2px;
    min-height: 72px;
    padding: 12px 14px;
}

.lottery-game-meter span,
.lottery-field-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.lottery-game-meter strong {
    color: var(--text);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.lottery-multiplier-panel {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.lottery-multiplier {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.lottery-multiplier-option {
    min-height: 52px;
    padding: 8px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
    font-size: 16px;
    font-weight: 900;
    touch-action: manipulation;
}

.lottery-multiplier-option:hover,
.lottery-multiplier-option.is-selected {
    color: var(--notion-blue);
    background: var(--badge-blue-bg);
    border-color: rgba(0, 117, 222, 0.22);
}

.lottery-multiplier-option:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

.lottery-status {
    min-height: 46px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
}

.lottery-status.is-win {
    color: #116737;
    background: var(--success-soft);
    border-color: rgba(31, 157, 85, 0.22);
}

.lottery-status.is-lose {
    color: #a62d28;
    background: var(--danger-soft);
    border-color: rgba(217, 72, 65, 0.22);
}

.lottery-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-self: center;
    width: 100%;
    max-width: 720px;
    gap: 10px;
}

.lottery-card {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 96px;
    aspect-ratio: 1 / 1;
    padding: 8px;
    overflow: hidden;
    background: linear-gradient(145deg, #fff, #fff8df);
    border: 1px solid rgba(216, 153, 23, 0.22);
    border-radius: 18px;
    box-shadow: rgba(35, 31, 26, 0.045) 0 8px 18px;
    touch-action: manipulation;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.lottery-card:hover:not(:disabled),
.lottery-card:focus-visible:not(:disabled) {
    border-color: rgba(216, 153, 23, 0.44);
    box-shadow: rgba(216, 153, 23, 0.16) 0 12px 24px;
    transform: translateY(-2px);
}

.lottery-card:disabled {
    cursor: default;
}

.lottery-card.is-opened {
    background: #fff;
}

.lottery-card.is-loading img {
    filter: saturate(1.08);
    transform: scale(1.03);
}

.lottery-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px;
    pointer-events: none;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.lottery-card-result {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 7px;
    padding: 4px 6px;
    overflow: hidden;
    color: var(--text);
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secondary-action {
    min-height: 56px;
    padding: 12px 18px;
    border-radius: 12px;
}

@media (max-width: 1100px) {
    .workspace-grid,
    .rules-grid {
        grid-template-columns: 1fr;
    }

    .history-panel {
        height: auto;
        min-height: auto;
    }

    .history-panel {
        order: 2;
    }

    .list-log {
        flex: none;
        height: 420px;
    }
}

@media (max-width: 900px) {
    .rule-button-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 20px, 1160px);
        padding: 16px 0 28px;
    }

    .hero-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
    }

    .lottery-entry {
        width: 100%;
        min-width: 0;
    }

    .lottery-entry-icon {
        width: 64px;
        height: 64px;
    }

    .hero-copy p {
        font-size: 16px;
    }

    .score-card {
        min-height: 126px;
    }

    .score-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }

    .history-page-panel .list-log {
        height: calc(100vh - 376px);
        min-height: 260px;
    }

    .history-totals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-total-card {
        min-height: 70px;
        padding: 10px;
    }

    .history-total-icon {
        width: 38px;
        height: 38px;
    }

    .history-total-number strong {
        font-size: 24px;
    }

    .action-panel {
        height: auto;
    }

    .panel-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .segmented-control {
        grid-template-columns: 1fr;
    }

    .segmented-control-compact {
        grid-template-columns: repeat(2, 1fr);
    }

    .rule-button-list,
    .rule-detail-grid {
        grid-template-columns: 1fr;
    }

    .lottery-quick-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lottery-dialog {
        width: calc(100vw - 18px);
        max-width: calc(100vw - 18px);
        margin: 9px auto;
    }

    .lottery-game-toolbar {
        grid-template-columns: 1fr;
    }

    .lottery-board {
        gap: 7px;
    }

    .lottery-card {
        min-height: 66px;
        padding: 5px;
        border-radius: 14px;
    }

    .lottery-card-result {
        display: none;
    }

    .manual-amount-row {
        grid-template-columns: 56px minmax(0, 1fr) 56px;
    }

    .manual-entry {
        grid-template-columns: 1fr;
    }

    .record-preview {
        grid-template-columns: 1fr;
    }

    .preview-result {
        grid-column: auto;
        grid-row: auto;
    }

    .record-input-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .record-input-group .reason-toggle,
    .record-input-group .reason-input {
        grid-column: 1 / -1;
    }

    .amount-input {
        max-width: none;
    }

    .action-footer {
        justify-content: stretch;
    }

    .primary-action {
        width: 100%;
    }

    .log-item {
        align-items: flex-start;
    }

    .log-reason {
        white-space: normal;
    }

    .log-amount {
        min-width: 112px;
        padding: 7px 8px;
    }
}
