.ctd-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 800px;
    margin: 20px auto;
    color: #1a1a2e;
    line-height: 1.6;
}

.ctd-container {
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
    border: 2px solid #1a3a5c;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(26, 58, 92, 0.15);
}

.ctd-title {
    text-align: center;
    font-size: 28px;
    color: #1a3a5c;
    margin: 0 0 5px;
    font-weight: 700;
    letter-spacing: 2px;
}

.ctd-subtitle {
    text-align: center;
    font-size: 14px;
    color: #5a7a9a;
    margin: 0 0 25px;
    font-style: italic;
}

.ctd-form-section {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #c0d0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.ctd-section-title {
    font-size: 16px;
    color: #1a3a5c;
    margin: 0 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #c0d0e0;
    font-weight: 600;
}

.ctd-note {
    font-size: 13px;
    color: #888;
    font-style: italic;
    margin: 0 0 12px;
}

.ctd-hao-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ctd-hao-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctd-hao-row label {
    width: 100px;
    font-size: 14px;
    font-weight: 500;
    color: #2a4a6a;
}

.ctd-hao-row input {
    flex: 1;
    max-width: 160px;
    padding: 8px 10px;
    border: 1px solid #a0b8d0;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.ctd-hao-row input:focus {
    border-color: #1a3a5c;
    box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}

.ctd-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.ctd-btn-primary {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a3a5c, #0e2440);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-radius: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ctd-btn-primary:hover {
    background: linear-gradient(135deg, #254d73, #163050);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 58, 92, 0.3);
}

.ctd-btn-export {
    background: linear-gradient(135deg, #2c6b3f, #1e4d2e);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 28px;
}

.ctd-btn-export:hover {
    background: linear-gradient(135deg, #358a50, #266838);
    transform: translateY(-1px);
}

.ctd-export-row {
    text-align: center;
    margin-top: 20px;
}

/* Result */
.ctd-result .ctd-section {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #c0d0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.ctd-result .ctd-section-title {
    color: #1a3a5c;
}

.ctd-main-hex {
    border-color: #1a3a5c !important;
    border-width: 2px !important;
}

.ctd-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
    font-size: 14px;
}

.ctd-info-item strong {
    color: #1a3a5c;
}

.ctd-hex-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.ctd-hex-number {
    background: #1a3a5c;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.ctd-hex-unicode {
    font-size: 36px;
    line-height: 1;
    color: #1a3a5c;
}

.ctd-hex-name {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}

.ctd-hex-body {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.ctd-hexagram-visual {
    flex-shrink: 0;
    padding: 10px;
}

.ctd-line-row {
    display: flex;
    align-items: center;
    margin: 6px 0;
    gap: 8px;
}

.ctd-line-num {
    font-size: 11px;
    color: #999;
    width: 16px;
    text-align: right;
}

.ctd-line {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 10px;
    width: 140px;
    position: relative;
}

.ctd-yang-bar {
    width: 100%;
    height: 8px;
    background: #1a3a5c;
    border-radius: 2px;
}

.ctd-yin-bar {
    width: 42%;
    height: 8px;
    background: #1a3a5c;
    border-radius: 2px;
}

.ctd-yin-gap {
    width: 16%;
    height: 8px;
}

.ctd-line.ctd-moving .ctd-yang-bar,
.ctd-line.ctd-moving .ctd-yin-bar {
    background: #d4a017;
}

.ctd-moving-mark {
    position: absolute;
    right: -22px;
    font-size: 14px;
    color: #d4a017;
    font-weight: bold;
}

.ctd-line-label {
    font-size: 11px;
    color: #888;
    margin-left: 4px;
    white-space: nowrap;
}

.ctd-hex-details {
    flex: 1;
    min-width: 250px;
}

.ctd-trigram-info {
    margin-bottom: 8px;
    font-size: 14px;
}

.ctd-trigram-role {
    color: #2a4a6a;
    font-weight: 500;
}

.ctd-hex-meaning {
    margin-top: 12px;
    padding: 10px;
    background: rgba(26, 58, 92, 0.06);
    border-left: 3px solid #1a3a5c;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
}

.ctd-analysis {
    border-color: #2a4a6a !important;
}

.ctd-td-item {
    margin-bottom: 8px;
    font-size: 15px;
}

.ctd-td-label {
    font-weight: 600;
    color: #2a4a6a;
}

.ctd-td-relation {
    margin: 15px 0;
    padding: 10px;
    background: rgba(26, 58, 92, 0.06);
    border-radius: 6px;
}

.ctd-td-verdict {
    padding: 12px;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
}

.ctd-td-verdict.ctd-good {
    background: rgba(34, 139, 34, 0.1);
    border: 1px solid rgba(34, 139, 34, 0.3);
    color: #1a6b1a;
}

.ctd-td-verdict.ctd-bad {
    background: rgba(220, 20, 60, 0.08);
    border: 1px solid rgba(220, 20, 60, 0.25);
    color: #b01030;
}

.ctd-td-verdict.ctd-neutral {
    background: rgba(26, 58, 92, 0.08);
    border: 1px solid rgba(26, 58, 92, 0.2);
    color: #1a3a5c;
}

@media (max-width: 600px) {
    .ctd-container { padding: 15px; margin: 10px; }
    .ctd-title { font-size: 22px; }
    .ctd-hex-body { flex-direction: column; }
    .ctd-info-grid { grid-template-columns: 1fr; }
    .ctd-hex-name { font-size: 18px; }
    .ctd-line { width: 110px; }
    .ctd-line-label { display: none; }
}
