.settings-section {
   display: flex;
   align-items: center;
   justify-content: flex-end;
   margin-bottom: var(--spacing-md);
   gap: 10px;
}

.animation-select-label {
   font-size: var(--font-size-14px);
   color: var(--text-color);
   font-weight: var(--font-weight-medium);
}

.animation-select {
   padding: var(--spacing-sm-plus) var(--spacing-md-plus);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-sm);
   background: var(--card-bg-color);
   color: var(--text-color);
   font-size: var(--font-size-14px);
   cursor: pointer;
   transition: var(--transition-default);
}

.animation-select:hover {
   border-color: var(--primary-color);
}

.animation-select:focus {
   outline: none;
   border-color: var(--primary-color);
}

.dice-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
   gap: 15px;
}

.dice-btn {
   padding: var(--spacing-lg);
   background: var(--card-bg-color);
   border: 3px solid var(--border-color);
   border-radius: var(--border-radius-md);
   cursor: pointer;
   font-size: 24px;
   font-weight: var(--font-weight-bold);
   transition: var(--transition-default);
   color: var(--text-color);
   text-align: center;
}

.dice-btn span {
   display: block;
   font-size: var(--font-size-12px);
   font-weight: var(--font-weight-normal);
   margin-top: var(--spacing-xs);
   color: var(--text-muted);
}

.dice-btn:hover {
   background: var(--primary-color);
   color: var(--white);
   border-color: var(--primary-color);
   transform: translateY(-3px);
}

.dice-btn:hover span {
   color: var(--white);
}

.custom-input {
   display: flex;
   align-items: center;
   gap: 10px;
   flex-wrap: wrap;
}

.custom-input input {
   width: 80px;
}

.custom-input select {
   width: 120px;
}

#dice-rule-amount {
   width: 80px;
}

.custom-input span {
   font-size: 20px;
   font-weight: var(--font-weight-bold);
   color: var(--text-color);
}

.mixed-dice-list {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
   gap: 15px;
   margin-bottom: var(--spacing-md);
}

.dice-card {
   background: var(--card-bg-color);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-md);
   overflow: hidden;
   transition: var(--transition-default);
}

.dice-card:hover {
   border-color: var(--primary-color);
   box-shadow: var(--shadow-hover);
}

.dice-card-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: var(--spacing-sm) var(--spacing-md);
   background: var(--background-color);
   border-bottom: 1px solid var(--border-color);
}

.dice-card-label {
   font-weight: var(--font-weight-semibold);
   color: var(--text-color);
   font-size: var(--font-size-14px);
}

.dice-card-remove {
   padding: var(--spacing-2xs) var(--spacing-sm-plus);
   background: var(--color-error);
   color: var(--white);
   border: none;
   border-radius: var(--border-radius-sm);
   cursor: pointer;
   font-size: var(--font-size-12px);
   transition: var(--transition-default);
}

.dice-card-remove:hover {
   background: var(--color-error-deep);
}

.dice-card-body {
   padding: var(--spacing-md);
}

.dice-card-row {
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin-bottom: var(--spacing-sm);
}

.dice-card-row:last-child {
   margin-bottom: 0;
}

.dice-card-row label {
   font-size: var(--font-size-13px);
   color: var(--text-muted);
   font-weight: var(--font-weight-medium);
}

.dice-card-row input,
.dice-card-row select {
   padding: var(--spacing-xs-plus) var(--spacing-sm);
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius-sm);
   font-size: var(--font-size-14px);
   background: var(--background-color);
   color: var(--text-color);
   width: 100px;
}

.dice-card-row input:focus,
.dice-card-row select:focus {
   outline: none;
   border-color: var(--primary-color);
}

.dice-rule-amount-row {
   animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
   from {
       opacity: 0;
       transform: translateY(-5px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

.dice-card-result {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding-top: var(--spacing-sm);
   border-top: 1px solid var(--border-color);
   margin-top: var(--spacing-sm);
}

.dice-result-label {
   font-size: var(--font-size-12px);
   color: var(--text-muted);
}

.dice-result-value {
   font-size: var(--font-size-16px);
   font-weight: var(--font-weight-semibold);
   color: var(--text-color);
}

.dice-result-value small {
   display: block;
   margin-top: 4px;
   margin-bottom: 0;
   font-size: var(--font-size-12px);
   font-weight: var(--font-weight-normal);
   line-height: 1.3;
}

.mixed-dice-controls {
   display: flex;
   flex-direction: column;
   gap: 15px;
}

.total-rule-section {
   display: flex;
   align-items: center;
   gap: 10px;
   padding: var(--spacing-md-plus);
   background: var(--card-bg-color);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-md);
}

.total-rule-section label {
   font-weight: var(--font-weight-semibold);
   color: var(--text-color);
   font-size: var(--font-size-14px);
}

.total-rule-section select {
   flex: 1;
   padding: var(--spacing-sm-plus) var(--spacing-md-plus);
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius-sm);
   font-size: var(--font-size-14px);
   background: var(--background-color);
   color: var(--text-color);
}

.total-rule-section input {
   width: 80px;
   padding: var(--spacing-sm-plus) var(--spacing-md-plus);
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius-sm);
   font-size: var(--font-size-14px);
   background: var(--background-color);
   color: var(--text-color);
}

.mixed-dice-buttons {
   display: flex;
   gap: 10px;
}

.presets-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
   gap: 10px;
   margin-bottom: var(--spacing-lg);
}

.preset-btn {
   padding: var(--spacing-md);
   background: var(--card-bg-color);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-md);
   cursor: pointer;
   transition: var(--transition-default);
   text-align: center;
}

.preset-btn:hover {
   background: var(--primary-color);
   color: var(--white);
   border-color: var(--primary-color);
   transform: translateY(-2px);
}

.preset-name {
   font-size: var(--font-size-14px);
   font-weight: var(--font-weight-semibold);
   margin-bottom: var(--spacing-xs);
   color: var(--text-color);
}

.preset-desc {
   font-size: var(--font-size-12px);
   color: var(--text-muted);
}

.preset-btn:hover .preset-desc {
   color: rgba(255, 255, 255, 0.8);
}

/* 夜间模式样式 */
body.dark-theme .preset-name {
   color: var(--text-color);
}

body.dark-theme .preset-desc,
body.dark-theme .placeholder-text {
   color: var(--text-muted);
}

.custom-presets-controls {
   display: flex;
   gap: 10px;
   margin-bottom: var(--spacing-md);
}

.custom-presets-controls input {
   flex: 1;
   padding: var(--spacing-sm);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-sm);
   font-size: var(--font-size-14px);
   background: var(--card-bg-color);
   color: var(--text-color);
}

.custom-presets-list {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
   gap: 15px;
}

.custom-preset-card {
   background: var(--card-bg-color);
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius-md);
   overflow: hidden;
   transition: var(--transition-default);
}

.custom-preset-card:hover {
   border-color: var(--primary-color);
   box-shadow: var(--shadow-hover);
}

.custom-preset-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: var(--spacing-md-plus) var(--spacing-md);
   background: var(--background-color);
   border-bottom: 1px solid var(--border-color);
}

.custom-preset-name {
   font-weight: var(--font-weight-semibold);
   color: var(--text-color);
   font-size: var(--font-size-15px);
}

.custom-preset-actions {
   display: flex;
   gap: 5px;
}

.custom-preset-actions button {
   padding: var(--spacing-xs) var(--spacing-md-plus);
   border: none;
   border-radius: var(--border-radius-sm);
   cursor: pointer;
   font-size: var(--font-size-12px);
   transition: var(--transition-default);
}

.roll-preset-btn {
   background: var(--primary-color);
   color: var(--white);
}

.roll-preset-btn:hover {
   background: var(--primary-hover-color);
}

.load-preset-btn {
   background: var(--color-success-btn);
   color: var(--white);
}

.load-preset-btn:hover {
   background: var(--color-success-btn-hover);
}

.delete-preset-btn {
   background: var(--color-error);
   color: var(--white);
}

.delete-preset-btn:hover {
   background: var(--color-error-deep);
}

.custom-preset-body {
   padding: var(--spacing-md);
}

.custom-preset-dice {
   font-size: var(--font-size-14px);
   color: var(--text-muted);
   line-height: 1.6;
}

.custom-preset-total-rule {
   margin-top: var(--spacing-sm-plus);
   font-size: var(--font-size-13px);
   color: var(--text-muted);
   font-weight: var(--font-weight-medium);
}

.dice-result-section {
   min-height: 120px;
   padding: var(--spacing-xl);
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius-md);
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   font-size: 32px;
   font-weight: var(--font-weight-bold);
   color: var(--primary-color);
   text-align: center;
   box-sizing: border-box;
}

.dice-result-box {
   width: 100%;
}

.dice-result-box .total {
   font-size: 28px;
   margin-top: var(--spacing-sm);
   color: var(--text-color);
   font-weight: var(--font-weight-bold);
}

.dice-result-box small {
   display: block;
   margin-top: var(--spacing-sm-plus);
   margin-bottom: 0;
   font-size: var(--font-size-16px);
   font-weight: var(--font-weight-normal);
   line-height: 1.4;
}

.total-dropped {
   margin-top: var(--spacing-md-plus);
   font-size: 32px;
   font-weight: var(--font-weight-bold);
   color: var(--text-muted);
}

.history-list {
   min-height: 120px;
   max-height: 25vh;
   overflow-y: auto;
   background: var(--card-bg-color);
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius-md);
   padding: var(--spacing-sm);
   margin-bottom: var(--spacing-sm);
   font-family: var(--font-mono);
   font-size: var(--font-size-14px);
   line-height: 1.4;
}

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

.history-list::-webkit-scrollbar-track {
   background: var(--background-color);
   border-radius: var(--border-radius-md);
}

.history-list::-webkit-scrollbar-thumb {
   background: var(--border-color);
   border-radius: var(--border-radius-md);
}

.history-list::-webkit-scrollbar-thumb:hover {
   background: var(--text-muted);
}

.empty-history {
   text-align: center;
   color: var(--text-muted);
   padding: var(--spacing-lg);
}

.history-item {
   margin-bottom: var(--spacing-sm-plus);
   padding-bottom: var(--spacing-sm-plus);
   border-bottom: 1px solid var(--border-color);
   font-size: var(--font-size-14px);
   color: var(--text-color);
}

.history-item:last-child {
   margin-bottom: 0;
   padding-bottom: 0;
   border-bottom: none;
}

.data-management {
   display: flex;
   flex-wrap: wrap;
   gap: 8px;
   margin-top: var(--spacing-sm);
}

.data-management button {
   flex: 1;
   min-width: 120px;
}

.data-controls {
   margin: var(--spacing-md) 0;
   display: flex;
   gap: var(--spacing-sm);
   justify-content: center;
}

.action-btn {
   flex: 1;
   padding: var(--spacing-sm) var(--spacing-lg);
   background: var(--primary-color);
   color: var(--white);
   border: none;
   border-radius: var(--border-radius-md);
   cursor: pointer;
   font-size: var(--font-size-14px);
   transition: var(--transition-default);
}

.action-btn:hover {
   background: var(--primary-hover-color);
}

.action-btn.secondary {
   background: var(--card-bg-color);
   color: var(--text-color);
   border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
   background: var(--border-color);
}

.placeholder-text {
   color: var(--text-muted);
   font-size: var(--font-size-16px);
   font-weight: var(--font-weight-normal);
}

.animation-scroll {
   animation: scrollText 0.15s ease-out;
   color: var(--text-color);
}

.animation-bounce {
   animation: bounceEffect 0.2s ease-out;
}

.animation-rotate {
   animation: rotateEffect 0.2s ease-out;
}

.animation-fade {
   animation: fadeEffect 0.15s ease-out;
}

.animation-scale {
   animation: scaleEffect 0.2s ease-out;
}

.animation-shake {
   animation: shakeEffect 0.2s ease-out;
}

@media (max-width: 768px) {
   .dice-grid {
       grid-template-columns: repeat(3, 1fr);
   }
   
   .custom-input {
       flex-direction: column;
       align-items: stretch;
   }
   
   .custom-input input,
   .custom-input select {
       width: 100%;
   }
   
   .mixed-dice-list {
       grid-template-columns: 1fr;
   }
   
   .dice-card-row input,
   .dice-card-row select {
       width: 100%;
   }
   
   .mixed-dice-controls {
       flex-direction: column;
   }
   
   .presets-grid {
       grid-template-columns: repeat(2, 1fr);
   }
   
   .custom-presets-controls {
       flex-direction: column;
   }
   
   .dice-result-box {
       font-size: 36px;
   }
}

@media (max-width: 480px) {
   .dice-grid {
       grid-template-columns: repeat(3, 1fr);
   }
   
   .custom-input {
       flex-direction: column;
       align-items: stretch;
   }
   
   .custom-input input,
   .custom-input select {
       width: 100%;
   }
   
   .dice-result-box {
       font-size: 36px;
   }
}


@media (max-width: 600px) {
    .mainbox {
        padding: var(--spacing-sm);
    }
}


@media (max-width: 900px) {
    /* 平板宽度: 容器间距收紧 */
    .mainbox {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 1200px) {
    /* 1200px: 大屏到中屏过渡,无特殊调整 */
}


@media (max-width: 1800px) {
    /* 1800px: 超大屏限制,无特殊调整 */
}
