body {
    margin: 0;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background-color: #2a2a2a;
    color: #eeeeee;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* タブレットのアドレスバー表示/非表示による高さのズレを吸収 */
}

.top-menu {
    background-color: #333333;
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #1a1a1a;
    position: relative;
    z-index: 100;
    gap: 4px;
    flex-wrap: wrap;
}

.top-menu-item {
    margin-right: 8px;
    padding: 8px 6px;
    cursor: pointer;
    font-size: 13px;
    position: relative;
    white-space: nowrap; /* テキストの折り返しを防止 */
    border-radius: 3px;
}

.top-menu-item:hover {
    color: #ffffff;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0; /* 各メニュー項目の左端に合わせる */
    background-color: #444444;
    min-width: 190px;
    border: 1px solid #1a1a1a;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 101;
}

.menu-option {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    min-height: 24px;
}

.menu-option:hover {
    background-color: #5288c1;
}

.menu-separator {
    height: 1px;
    background-color: #555555;
    margin: 4px 0;
}

.learning-mode {
    margin-left: auto;
    background-color: #444444;
    padding: 3px 10px;
    border-radius: 3px;
    color: #33cc33;
}

.icon-toolbar {
    display: flex;
    gap: 6px;
    margin-left: 12px;
}

.icon-btn {
    width: 40px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #444444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.icon-btn:hover {
    background-color: #5288c1;
}

.icon-btn:active {
    background-color: #3f6f9c;
}

.icon-btn.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sidebar {
    width: 220px;
    min-width: 180px;
    max-width: 240px;
    background-color: #333333;
    border-right: 1px solid #1a1a1a;
    padding: 10px;
    overflow-y: auto;
}

.panel-title {
    background-color: #444444;
    padding: 5px;
    margin-bottom: 10px;
    border-radius: 3px;
    font-size: 12px;
}

.tool-group {
    margin-bottom: 15px;
}

.tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.tool-button {
    width: 48px;
    height: 48px;
    background-color: #555555;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    cursor: pointer;
}

.tool-button:hover {
    background-color: #666666;
}

.tool-button.active {
    background-color: #5288c1;
}

.tool-label {
    font-size: 14px;
    font-weight: bold;
}

.tool-icon {
    font-size: 18px;
    font-weight: bold;
}

.material-control {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
}

.material-control label {
    width: 60px;
}

.color-swatch {
    width: 44px;
    height: 28px;
    border-radius: 3px;
    margin-left: 5px;
    cursor: pointer;
    border: 1px solid #1a1a1a;
    padding: 0;
    background: none;
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.material-slider {
    flex: 1;
    margin-left: 5px;
    height: 32px; /* タッチ操作のためヒット領域を広く確保 */
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.material-slider::-webkit-slider-runnable-track {
    height: 6px;
    background-color: #444444;
    border-radius: 3px;
}

.material-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    margin-top: -9px;
    border-radius: 50%;
    background-color: #5288c1;
    cursor: pointer;
}

.material-slider::-moz-range-track {
    height: 6px;
    background-color: #444444;
    border-radius: 3px;
}

.material-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #5288c1;
    border: none;
    cursor: pointer;
}

.action-button {
    background-color: #555555;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 10px;
    text-align: center;
}

.action-button:hover {
    background-color: #666666;
}

.viewport {
    flex: 1;
    position: relative;
    min-width: 320px; /* タブレット幅でも表示領域を確保できる最小値 */
}

.status-bar {
    height: 25px;
    background-color: #333333;
    border-top: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 11px;
    color: #cccccc;
}

.status-info {
    margin-right: 20px;
}

.edit-mode-status {
    margin-left: auto;
}

.mode-selector {
    min-height: 44px;
    background-color: #444444;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    gap: 8px;
}

.mode-button {
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    background-color: #333333;
    color: #cccccc;
}

.mode-button.active {
    background-color: #5288c1;
    color: #ffffff;
}

.axis-helper {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    color: #ffffff;
    pointer-events: none;
}

.tutorial-overlay {
    position: absolute;
    bottom: 40px;
    right: 10px;
    background-color: rgba(51, 51, 51, 0.8);
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    width: 300px;
    display: none;
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #33cc33;
}

.tutorial-step-content {
    min-height: 36px;
}

.tutorial-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.tutorial-nav-btn {
    background-color: #555555;
    color: #eeeeee;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 12px;
    cursor: pointer;
}

.tutorial-nav-btn:hover:not(:disabled) {
    background-color: #5288c1;
}

.tutorial-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.tutorial-step-counter {
    font-size: 11px;
    color: #cccccc;
    white-space: nowrap;
}

.shortcut-hint {
    position: absolute;
    bottom: 40px;
    right: 10px;
    background-color: rgba(51, 51, 51, 0.8);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 11px;
    color: #eeeeee;
    display: none;
}

.shortcut-hint.active {
    display: block;
}

/* 選択された頂点/辺/面のスタイル */
.selected-vertex,
.selected-edge,
.selected-face {
    color: #ffff00;
}

/* 押し出し操作ガイド */
.extrude-guide {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(51, 51, 51, 0.8);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 11px;
    color: #eeeeee;
    display: none;
}

.extrude-guide.active {
    display: block;
}