
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f7;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}
.container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: clamp(15px, 3vh, 30px) clamp(20px, 4vw, 40px);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    max-width: 1600px;
    width: 95vw;
    height: 92vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
}
header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: clamp(15px, 2.5vh, 25px);
}
h1 {
    margin: 0;
    font-size: clamp(20px, 2.5vw, 28px);
    font-weight: 700;
    letter-spacing: -0.022em;
}
.badge {
    background: #f2f2f7;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
}
.main-layout {
    display: grid;
    grid-template-columns: minmax(280px, 30%) 1fr;
    gap: clamp(15px, 3vw, 30px);
    flex: 1;
    min-height: 0;
}
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.input-card {
    flex: none;
    background: #ffffff;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #86868b;
    font-size: 12px;
}
input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 15px;
    background: #f5f5f7;
    box-sizing: border-box;
    transition: all 0.2s;
}
input:focus {
    outline: none;
    border-color: #0071e3;
    background: #ffffff;
}
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.save-btn {
    background-color: #34c759;
    color: white;
}
.save-btn:hover { background-color: #28a745;
}
.search-card {
    flex: none;
    background: #ffffff;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.history-container {
    flex: 2;
    min-height: 0;
    background: #ffffff;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#history-items {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}
.history-container h3 {
    margin-top: 0;
    font-size: 16px;
    margin-bottom: 12px;
}
.history-item {
    padding: 12px;
    border-bottom: 1px solid #f2f2f7;
    cursor: pointer;
    transition: background 0.2s;
}
.history-item:hover {
    background: #f5f5f7;
}
.history-item:last-child {
    border-bottom: none;
}
.history-info {
    font-size: 13px;
    color: #1d1d1f;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-index {
    background: #f2f2f7;
    color: #86868b;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.history-meta {
    font-size: 11px;
    color: #86868b;
}
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    padding: 24px;
    border-radius: 22px;
    width: 280px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: modalPop 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes modalPop {
from { transform: scale(0.9) translateY(15px); opacity: 0;
}
to { transform: scale(1) translateY(0); opacity: 1;
}
}
.alert-content {
    text-align: center;
}
.alert-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #000;
}
.alert-content p {
    margin: 0 0 24px;
    color: #1d1d1f;
    font-size: 14px;
    line-height: 1.4;
}
.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
}
.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}
button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.primary-btn {
    background-color: #0071e3;
    color: white;
}
.primary-btn:hover { background-color: #0077ed;
}
.secondary-btn {
    background-color: #f2f2f7;
    color: #0071e3;
}
.secondary-btn:hover { background-color: #e5e5ea;
}
.result-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: none;
    max-height: 40%;
    overflow-y: auto;
    padding-right: 5px;
}
.summary-card {
    background: #f5f5f7;
    padding: 12px 16px;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.summary-card .label { font-size: 14px; color: #86868b; flex-shrink: 0;
}
.summary-card .value { font-size: clamp(20px, 2.5vh, 28px); font-weight: 700; color: #0071e3; text-align: right; flex: 1;
}
.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.detail-item {
    background: #ffffff;
    padding: 15px;
    border-radius: 18px;
    border: 1px solid #f2f2f7;
}
.item-header {
    font-size: 12px;
    color: #86868b;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}
.item-body {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
}
.optimization-note {
    padding: 12px 15px;
    background: #fff9e6;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    color: #b7791f;
    border: 1px solid #ffecb3;
}
.right-panel {
    min-height: 0;
}
.viz-card {
    background: #ffffff;
    height: 100%;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
}
#canvas-container {
    flex: 1;
    background: #fbfbfd;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    min-height: 0;
}
#main-rect {
    background: #ffffff;
    border: 1px solid #1d1d1f;
    position: relative;
    box-sizing: border-box;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.grid-line {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
}
.cut-line {
    position: absolute;
    display: none;
    pointer-events: none;
    z-index: 5;
}
#cut-line-v { top: 0; bottom: 0; right: 0; background-color: rgba(220, 38, 38, 0.05);
}
#cut-line-h { left: 0; right: 0; bottom: 0; background-color: rgba(220, 38, 38, 0.05);
}
.viz-label {
    position: absolute;
    font-size: 11px;
    white-space: nowrap;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
#label-length { top: -30px; left: 50%; transform: translateX(-50%);
}
#label-width { left: -15px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: left center;
}
.disclaimer {
    text-align: center;
    font-size: 14px;
    color: #ff3b30;
    font-weight: 600;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 59, 48, 0.05);
    border-radius: 12px;
}
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #86868b;
}
.legend-item { display: flex; align-items: center; gap: 6px;
}
.legend-color { width: 10px; height: 10px; border-radius: 3px;
}
.blue-text { color: #0071e3;
}
.red-text { color: #dc2626;
}

