/* ============================
   wheel.css - 任务转盘/骰子
   黑白简约线条风格
   ============================ */

.wheel-container {
    max-width: 600px;
    padding: 20px;
    padding-bottom: 100px;
}

.tool-header {
    text-align: center;
    margin-bottom: 1.2rem;
}
.tool-header h1 {
    font-size: 1.6rem;
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.tool-desc {
    color: var(--muted);
    font-size: 0.85rem;
}

/* 模式切换 */
.mode-tabs {
    display: flex;
    border: 2px solid var(--fg);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.mode-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--bg);
    color: var(--fg);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.mode-tab.active {
    background: var(--fg);
    color: var(--bg);
    font-weight: bold;
}

/* ===== 转盘 ===== */
.wheel-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}
#wheelCanvas {
    border: 2px solid var(--fg);
    border-radius: 50%;
    background: var(--bg);
}
.wheel-pointer {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid var(--fg);
    z-index: 5;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}
.spin-btn {
    margin-top: 1rem;
    padding: 12px 40px;
    border: 2px solid var(--fg);
    background: var(--fg);
    color: var(--bg);
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.spin-btn:hover {
    background: var(--bg);
    color: var(--fg);
}
.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 结果显示 */
.result-display {
    text-align: center;
    padding: 12px 16px;
    border: 2px solid var(--fg);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: var(--hover-bg);
}
.result-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.result-value {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
}
.result-detail {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 4px;
}

/* 编辑器 */
.wheel-editor, .dice-history {
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.editor-header label {
    font-size: 0.9rem;
    font-weight: bold;
}
.editor-actions {
    display: flex;
    gap: 10px;
}
.add-link {
    font-size: 0.78rem;
    color: var(--muted);
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--hover-bg);
}
.add-link:hover { color: var(--fg); }
.add-link.danger:hover { color: #d32f2f; }

.wheel-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wheel-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wheel-item input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid var(--light-border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--fg);
}
.wheel-item input:focus {
    outline: none;
    border-color: var(--fg);
}
.wheel-item .item-del {
    width: 24px;
    height: 24px;
    border: 1px solid var(--light-border);
    background: var(--bg);
    color: #d32f2f;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.wheel-item .item-del:hover {
    border-color: #d32f2f;
    background: #fff5f5;
}
.editor-tip {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 8px;
    margin-bottom: 0;
}

/* ===== 骰子 ===== */
.dice-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
}
.dice-controls label {
    font-size: 0.85rem;
    color: var(--muted);
}
.dice-count-opts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.dice-count-opt {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--light-border);
    background: var(--bg);
    color: var(--fg);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.2s;
}
.dice-count-opt.active {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}
.dice-sides {
    padding: 6px 10px;
    border: 1.5px solid var(--light-border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--fg);
}

.dice-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1rem;
}
.dice-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 70px;
    align-items: center;
}

/* 骰子方块 */
.die {
    width: 56px;
    height: 56px;
    border: 2px solid var(--fg);
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--fg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.die.rolling {
    animation: dice-shake 0.1s ease-in-out infinite;
}
@keyframes dice-shake {
    0%, 100% { transform: rotate(0) translateY(0); }
    25% { transform: rotate(-8deg) translateY(-3px); }
    50% { transform: rotate(0) translateY(0); }
    75% { transform: rotate(8deg) translateY(-3px); }
}

/* D6用点表示 */
.die.d6 {
    position: relative;
}
.die.d6 .dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--fg);
    border-radius: 50%;
}

.roll-btn {
    padding: 12px 40px;
    border: 2px solid var(--fg);
    background: var(--fg);
    color: var(--bg);
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.roll-btn:hover {
    background: var(--bg);
    color: var(--fg);
}
.roll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 骰子历史 */
.dice-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}
.dice-history-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}
.dice-history-item .dice-time {
    color: var(--muted);
    font-size: 0.75rem;
}
.dice-history-empty {
    text-align: center;
    color: var(--muted);
    padding: 20px;
    font-size: 0.85rem;
}

/* 预设弹窗 */
.preset-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.preset-box {
    background: var(--bg);
    border-radius: 10px;
    padding: 1.4rem;
    max-width: 400px;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
}
.preset-box h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}
.preset-option {
    padding: 10px 14px;
    border: 1.5px solid var(--light-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.preset-option:hover {
    border-color: var(--fg);
    background: var(--hover-bg);
}
.preset-option .preset-name {
    font-weight: bold;
    margin-bottom: 3px;
}
.preset-option .preset-preview {
    font-size: 0.75rem;
    color: var(--muted);
}
.preset-close {
    width: 100%;
    padding: 8px;
    border: 1.5px solid var(--fg);
    background: var(--bg);
    color: var(--fg);
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

@media (max-width: 480px) {
    .wheel-container { padding: 12px; }
    .tool-header h1 { font-size: 1.3rem; }
    #wheelCanvas { width: 260px; height: 260px; }
    .die { width: 48px; height: 48px; font-size: 1.2rem; }
    .dice-count-opt { width: 34px; height: 34px; }
}
