* {
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 24px 16px;
    background-color: #ffffff;
    color: #0a0a0a;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 720px;
    min-width: 600px;
    margin: 0 auto;
}

header {
    margin-bottom: 24px;
}

h1 {
    font-size: 30px;
    font-weight: 600;
    color: #0a0a0a;
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.input-section {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #0a0a0a;
    margin-bottom: 6px;
}

.instructions {
    color: #737373;
    font-size: 14px;
    margin: 0 0 12px 0;
    line-height: 1.75;
}

.instructions b {
    color: #0a0a0a;
    font-weight: 500;
}

.warning {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #fecaca;
}

.warning.hidden {
    display: none;
}

#xgidInput {
    width: 100%;
    height: 32px;
    padding: 6px 10px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #ffffff;
    color: #0a0a0a;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#xgidInput:focus {
    outline: none;
    border-color: #a3a3a3;
    box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.2);
}

#xgidInput::placeholder {
    color: #a3a3a3;
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: nowrap;
}

.style-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.style-selector label {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #737373;
}

#styleSelect {
    height: 32px;
    padding: 0 28px 0 10px;
    font-size: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #ffffff;
    color: #0a0a0a;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

#styleSelect:focus {
    outline: none;
    border-color: #a3a3a3;
    box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.2);
}

#saveBtn, #copyLinkBtn {
    height: 32px;
    padding: 0 12px;
    background-color: #171717;
    color: #fafafa;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.15s;
}

#saveBtn:hover, #copyLinkBtn:hover {
    background-color: #262626;
}

#saveBtn:active, #copyLinkBtn:active {
    background-color: #404040;
}

.diagram-section {
    padding: 16px 24px;
    text-align: center;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #ffffff;
}

.diagram-section:has(+ .analysis-section:not(.hidden)) {
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

#boardCanvas {
    max-width: 100%;
    height: auto;
}

.position-info {
    display: none;
}

.analysis-section {
    margin-top: -1px;
    padding: 8px 24px 20px;
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #ffffff;
    text-align: center;
}

.analysis-section.hidden {
    display: none;
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.analysis-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 500;
    color: #737373;
    font-size: 14px;
}

.analysis-table th:first-child,
.analysis-table td:first-child {
    padding-left: 0;
}

.analysis-table th:last-child,
.analysis-table td:last-child {
    padding-right: 0;
}

.analysis-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f5f5f5;
}

.analysis-table tr:last-child td {
    border-bottom: none;
}

.analysis-table tr.best-move td {
    background: #f5f5f5;
}

.analysis-table .num {
    width: 28px;
    color: #737373;
}

.analysis-table .move {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
}

.analysis-table .equity {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
}

.analysis-table .percentages {
    color: #737373;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
}

.checker-play-table th:last-child {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.checker-play-analysis,
.cube-analysis {
    max-width: 492px;
    margin: 0 auto;
    text-align: left;
}

.analysis-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #0a0a0a;
    margin-bottom: 12px;
    margin-top: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}

.analysis-section-title:first-child {
    margin-top: 0;
}

.max-bracs {
    font-size: 14px;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    margin-top: 16px;
    color: #0a0a0a;
}

.cubeless-equities {
    font-size: 14px;
    color: #737373;
    line-height: 1.6;
}

.cubeless-equities strong {
    color: #0a0a0a;
    font-weight: 500;
}

.cube-actions-table {
    width: 100%;
}

.cube-actions-table th,
.cube-actions-table td {
    padding: 8px 12px;
    font-size: 14px;
}

.cube-actions-table th:first-child,
.cube-actions-table td:first-child {
    padding-left: 0;
}

.cube-actions-table th:last-child,
.cube-actions-table td:last-child {
    padding-right: 0;
}

.cube-actions-table th {
    color: #0a0a0a;
    font-weight: 500;
    white-space: nowrap;
}

.cube-actions-table td:first-child {
    text-align: left;
}

.cube-actions-table td.equity {
    text-align: left;
    white-space: nowrap;
}

.cube-actions-table td.explanation {
    color: #737373;
    font-size: 13px;
    padding-left: 16px;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f5f5f5;
    color: #737373;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: background 0.15s;
}

.help-icon:hover {
    background: #e5e5e5;
}
