@import url('https://unpkg.com/purecss@3.0.0/build/pure-min.css');
@import url('https://unpkg.com/purecss@3.0.0/build/grids-responsive-min.css');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    line-height: 1.6;
}

.layout {
    min-height: 100vh;
}

.header {
    background: #031161;
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.header img {
    max-height: 60px;
    vertical-align: middle;
}

.header a {
    color: white;
    text-decoration: none;
}

.lang-switch {
    display: flex;
    gap: 1rem;
}

.lang-switch a {
    padding: 0.3rem 0.8rem;
    border: 1px solid white;
    border-radius: 4px;
    transition: background 0.2s;
}

.lang-switch a:hover {
    background: rgba(255,255,255,0.2);
}

.lang-switch a.active {
    background: white;
    color: #1f8dd6;
}

.menubar {
    background: #031161;
    width: 220px;
    position: fixed;
    top: 76px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.menubar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menubar li a {
    display: block;
    padding: 1rem 1.5rem;
    color: #ccc;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.menubar li a:hover {
    background: #404040;
    color: white;
}

.menubar li a.active {
    background: #08042e;
    color: white;
    border-left-color: #4a4ae2;
}

.main-content {
    margin-left: 220px;
    padding: 2rem;
    padding-top: calc(76px + 2rem);
    max-width: 1000px;
}

.home-header {
    margin-bottom: 2rem;
}

.home-title {
    color: #08042e;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 2px solid #08042e;
    padding-bottom: 1rem;
}

.home-subtitle {
    text-align: left;
}

.home-subtitle h2 {
    color: #08042e;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.home-subtitle ul {
    list-style: disc;
    padding-left: 2rem;
    margin: 1rem 0;
}

.home-subtitle li {
    margin: 0.5rem 0;
    color: #333;
}

.home-footer {
    margin-top: 1.5rem;
    font-weight: 500;
    color: #08042e;
    font-style: italic;
}

.main-hero-img {
    display: block;
    margin: 2rem auto;
    max-width: 100%;
}

.page-title {
    color: #08042e;
    border-bottom: 2px solid #08042e;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    color: #555;
    font-size: 1.3rem;
    margin-top: 1.5rem;
}

.content-section p {
    margin: 0.8rem 0;
}

.content-section ul {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}

.content-section li {
    margin: 0.5rem 0;
}

.content-section dl {
    margin: 1rem 0;
}

.content-section dt {
    font-weight: bold;
    color: #08042e;
    margin-top: 1rem;
}

.content-section dd {
    margin-left: 0;
    margin-top: 0.3rem;
}

.faq-item {
    margin: 1.5rem 0;
}

.faq-item dt {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.faq-item dd {
    margin-left: 0;
    padding: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
}

.links-table {
    width: 100%;
    border-collapse: collapse;
}

.links-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.links-table img {
    vertical-align: middle;
    margin-right: 1rem;
}

.video-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ccc;
    padding: 3rem;
    text-align: center;
    color: #888;
    margin: 2rem 0;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 1rem;
    text-align: center;
}

.contact-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 1rem;
    border-radius: 4px;
    color: #856404;
}

.profile-image {
    float: right;
    margin: 1rem;
    max-width: 250px;
}

.profile-image img {
    max-width: 100%;
    border-radius: 4px;
}

.clearfix::after {
    content: "";
    clear: both;
    display: table;
}

table.info-table {
    width: 100%;
    border-collapse: collapse;
}

table.info-table th,
table.info-table td {
    padding: 0.8rem;
    border: 1px solid #ddd;
    text-align: left;
}

table.info-table th {
    background: #f5f5f5;
    color: #08042e;
    width: 200px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .menubar {
        position: fixed;
        width: 100%;
        top: 76px;
        left: -100%;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .menubar.open {
        left: 0;
    }

    .menubar ul {
        display: flex;
        flex-wrap: wrap;
    }

    .menubar li {
        width: 50%;
    }

    .main-content {
        margin-left: 0;
        padding-top: 1rem;
    }

    .header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header h1 {
        flex: 1;
    }

    .profile-image {
        float: none;
        display: block;
        margin: 1rem auto;
        max-width: 200px;
    }

    .links-table img {
        width: 80px;
        height: auto;
    }
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.tool-card {
    display: block;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.tool-card:hover {
    border-color: #08042e;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.tool-card .tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h2 {
    color: #08042e;
    font-size: 1.3rem;
    margin: 0.5rem 0;
}

.tool-card p {
    color: #666;
    font-size: 0.95rem;
    margin: 0.5rem 0 0 0;
}

.tool-card-desc {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-top: 0.5rem;
}

.tool-page-desc {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.tool-form {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.tool-form .pure-form {
    max-width: 600px;
    margin: 0 auto;
}

.tool-form label {
    font-weight: bold;
    color: #08042e;
    display: block;
    margin-bottom: 0.5rem;
}

.tool-form input,
.tool-form select {
    width: 100%;
    padding: 0.4rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.tool-form .button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.tool-result {
    background: white;
    border: 2px solid #08042e;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
}

.tool-result h3 {
    color: #08042e;
    margin-bottom: 1rem;
}

.tool-result .result-value {
    font-size: 2rem;
    font-weight: bold;
    color: #08042e;
}

.tool-result .result-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.tool-result .stokes {
    color: #28a745;
}

.tool-result .anti-stokes {
    color: #dc3545;
}

.pure-button-primary-tool {
    background: #08042e;
    color: white;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.pure-button-primary-tool:hover {
    background: #1a1a4a;
}