:root {
    --gold-primary: #D4AF37;
    --gold-dark: #B8860B;
    --gold-bg: #fffcf2;
    --text-dark: #2c3e50;
    --text-muted: #5a6268;
    --light-gray: #f9f9f9;
    --border-soft: #eee;
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.06);
    --radius-lg: 24px;
    --radius-md: 16px;
    --nav-h: 64px;
    --container: 960px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
    margin: 0;
    background-color: #ffffff;
    color: var(--text-dark);
    line-height: 1.8;
    opacity: 1;
    -webkit-font-smoothing: antialiased;
}

body[dir="rtl"] {
    font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
}

/* ---------- Nav ---------- */
nav {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 10px 4%;
    min-height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.brand-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-dropdown {
    position: relative;
}

.nav-btn {
    background: #fff;
    border: 1.5px solid var(--gold-primary);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gold-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
}

/* Icon-only: tools + language (keeps brand title readable on mobile) */
.nav-btn-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.nav-btn:hover,
.nav-btn:focus-visible {
    background: var(--gold-bg);
    outline: none;
}

.nav-btn[aria-expanded="true"] {
    background: var(--gold-bg);
}

.nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    padding: 8px;
    z-index: 1200;
}

.nav-menu.is-open {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}

.nav-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
    background: var(--gold-bg);
    outline: none;
}

.nav-menu a.is-active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(184, 134, 11, 0.12));
    color: var(--gold-dark);
    font-weight: 700;
}

/* Tools dropdown items — 2 per row so all tools stay visible */
.tools-menu {
    width: min(92vw, 460px);
    min-width: 0;
    max-width: calc(100vw - 24px);
    max-height: none;
    overflow: visible;
}

.tools-menu.is-open {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.tools-menu a {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    min-width: 0;
}

.tools-menu .tool-menu-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gold-bg);
    border: 1px solid rgba(212, 175, 55, 0.35);
    font-size: 1rem;
    line-height: 1;
}

.tools-menu .tool-menu-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tools-menu .tool-menu-title {
    font-weight: 700;
    color: var(--gold-dark);
    line-height: 1.3;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.tools-menu .tool-menu-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
    font-weight: 400;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* ---------- Hero ---------- */
.hero {
    padding: clamp(40px, 6vw, 72px) 20px clamp(72px, 10vw, 110px);
    text-align: center;
    background: linear-gradient(180deg, var(--gold-bg) 0%, #ffffff 100%);
    overflow: visible;
}

/* Sun animation (aligned with https://zengo.day/) — also inlined in HTML head */
.sun-glow {
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, #fff7e6 20%, #ffcc00 60%, #ffaa00 100%);
    border-radius: 50%;
    margin: 0 auto 50px;
    position: relative;
    box-shadow:
        0 0 60px rgba(255, 204, 0, 0.8),
        0 0 120px rgba(255, 170, 0, 0.4),
        0 0 200px rgba(255, 255, 255, 0.2);
    animation: sun-pulse 4s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sun-glow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    margin-top: -125px;
    margin-left: -125px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 230, 150, 0.2) 10deg,
        transparent 20deg,
        rgba(255, 230, 150, 0.2) 40deg,
        transparent 50deg
    );
    border-radius: 50%;
    animation: rotate-rays 20s linear infinite;
    mask-image: radial-gradient(circle, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle, black 30%, transparent 70%);
    pointer-events: none;
}

.sun-glow::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 204, 0, 0.5);
    animation: wave-burst 3s infinite ease-out;
    box-sizing: border-box;
}

@keyframes sun-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.08); filter: brightness(1.2); }
}

@keyframes rotate-rays {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes wave-burst {
    0% { transform: scale(1); opacity: 0.8; border-width: 8px; }
    100% { transform: scale(4); opacity: 0; border-width: 1px; }
}

.main-title {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    color: var(--gold-dark);
    margin: 0 0 16px;
    font-weight: 800;
    line-height: 1.25;
}

.hero-subtitle {
    margin: 0 auto;
    max-width: 720px;
    font-size: clamp(0.98rem, 2.2vw, 1.1rem);
    color: var(--text-muted);
    padding: 0 8px;
}

/* ---------- Layout ---------- */
.container {
    max-width: var(--container);
    margin: -48px auto 0;
    padding: 0 clamp(14px, 3vw, 24px) clamp(64px, 8vw, 100px);
}

.content-card {
    background: #ffffff;
    padding: clamp(22px, 4vw, 40px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: clamp(22px, 3vw, 36px);
}

h2 {
    color: var(--gold-dark);
    border-bottom: 2px solid var(--gold-bg);
    padding-bottom: 10px;
    margin: 0 0 22px;
    font-size: clamp(1.25rem, 3vw, 1.55rem);
}

h3, h4 {
    margin: 0;
}

.section-lead {
    margin: 0 0 20px;
    color: var(--text-muted);
}

/* ---------- Lights ---------- */
.light-item-box {
    padding: clamp(16px, 3vw, 25px);
    border-radius: 20px;
    background: #fffdf9;
    border: 1px solid #f1e0ad;
    margin-bottom: 16px;
}

.light-item-box:last-child {
    margin-bottom: 0;
}

.light-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.light-header h3 {
    color: var(--gold-dark);
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    line-height: 1.35;
}

.light-icon {
    font-size: 1.7rem;
    flex-shrink: 0;
}

.light-item-box p {
    margin: 0;
    color: var(--text-muted);
}

/* ---------- Flex CTA rows ---------- */
.flex-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(16px, 3vw, 28px);
}

.flex-text {
    flex: 1 1 auto;
    min-width: 0;
}

.flex-text p {
    margin: 0 0 12px;
}

.flex-text p:last-child {
    margin-bottom: 0;
}

.highlight-text {
    color: var(--gold-dark);
    font-weight: 700;
}

.btn-square {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: white !important;
    padding: 18px 16px;
    width: 200px;
    min-height: 96px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.35);
    flex-shrink: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    line-height: 1.35;
}

.btn-square:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(212, 175, 55, 0.45);
}

/* ---------- Tools ---------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    text-decoration: none;
    padding: 20px 18px;
    border-radius: var(--radius-md);
    border: 1px solid #f1e0ad;
    background: linear-gradient(160deg, #fffdf7 0%, #ffffff 70%);
    transition: var(--transition);
    min-height: 150px;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(212, 175, 55, 0.18);
    border-color: var(--gold-primary);
}

.tool-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--gold-bg);
    border: 1px solid rgba(212, 175, 55, 0.35);
}

.tool-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold-dark);
    line-height: 1.3;
}

.tool-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}

.tool-link {
    margin-top: auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold-dark);
}

/* ---------- Goals ---------- */
.goal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.goal-item {
    background: var(--gold-bg);
    padding: 18px 16px;
    border-radius: 15px;
    border-top: 4px solid var(--gold-primary);
}

.goal-item h4 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.goal-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---------- Cases ---------- */
.case-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 8px;
}

.case-highlight-box {
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 20px;
    padding: clamp(20px, 3.5vw, 32px);
    position: relative;
    transition: var(--transition);
}

.case-highlight-box:hover {
    border-color: #f1e0ad;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.04);
}

.case-tag {
    display: inline-block;
    background: var(--gold-bg);
    color: var(--gold-dark);
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.case-title {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 14px;
    line-height: 1.4;
}

.case-body {
    font-size: 1rem;
    color: var(--text-muted);
    border-inline-start: 3px solid var(--gold-bg);
    padding-inline-start: 16px;
    margin-bottom: 16px;
}

.case-author {
    font-weight: 700;
    color: var(--gold-dark);
    text-align: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.case-author::before {
    content: "";
    width: 30px;
    height: 1px;
    background-color: var(--gold-primary);
}

.witness-full-btn {
    display: block;
    text-align: center;
    margin-top: 28px;
    padding: 16px 18px;
    border: 2px solid var(--gold-primary);
    color: var(--gold-dark);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 800;
    transition: background 0.25s ease, color 0.25s ease;
}

.witness-full-btn:hover {
    background: var(--gold-bg);
}

/* ---------- Refs ---------- */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ref-card {
    text-decoration: none;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.ref-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.ref-image {
    width: 100%;
    height: 170px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.ref-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.35s ease;
}

.ref-card:hover .ref-image img {
    transform: scale(1.08);
}

.ref-info {
    padding: 14px 12px;
    font-size: 0.92rem;
    color: var(--text-dark);
    font-weight: 600;
    text-align: center;
    line-height: 1.45;
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 48px 20px 56px;
    color: #888;
    margin-top: 8px;
    border-top: 1px solid #f3f3f3;
}

footer p {
    margin: 6px 0;
}

.footer-source {
    color: #999;
    font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ref-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    nav {
        padding: 10px 3.5%;
    }

    .brand-name {
        font-size: 0.95rem;
        letter-spacing: 0.5px;
    }

    .container {
        margin-top: -36px;
    }

    .flex-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-square {
        width: 100%;
        min-height: 72px;
    }

    .goal-grid {
        grid-template-columns: 1fr;
    }

    .ref-grid {
        grid-template-columns: 1fr;
    }

    .ref-image {
        height: 190px;
    }

    .sun-glow {
        width: 76px;
        height: 76px;
        margin-bottom: 36px;
    }

    .sun-glow::before {
        width: 200px;
        height: 200px;
        margin-top: -100px;
        margin-left: -100px;
    }

    /* Keep tools panel inside the viewport (button is not at the screen edge) */
    .tools-menu {
        position: fixed;
        top: calc(var(--nav-h) + 6px);
        inset-inline: 12px;
        width: auto;
        max-width: none;
        max-height: min(70vh, calc(100dvh - var(--nav-h) - 24px));
        overflow-x: hidden;
        overflow-y: auto;
    }

    .tools-menu a {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 8px;
    }

    .tools-menu .tool-menu-title {
        font-size: 0.82rem;
    }

    .tools-menu .tool-menu-desc {
        font-size: 0.68rem;
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        min-height: 0;
    }

    .content-card {
        border-radius: 18px;
        padding: 18px 16px;
    }

    .case-highlight-box {
        border-radius: 16px;
        padding: 16px;
    }

    .nav-menu {
        min-width: min(86vw, 260px);
    }

    .nav-btn-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1.08rem;
    }

    .nav-actions {
        gap: 6px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .btn-square {
        width: 180px;
    }
}

/* ---------- Feedback modal ---------- */
.feedback-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(20, 24, 30, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.feedback-overlay[hidden] {
    display: none !important;
}

.feedback-dialog {
    width: min(480px, 100%);
    max-height: min(90vh, 720px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    padding: 22px 20px 18px;
    border: 1px solid rgba(212, 175, 55, 0.28);
}

.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.feedback-header h2 {
    margin: 0;
    border: 0;
    padding: 0;
    font-size: 1.25rem;
    color: var(--gold-dark);
}

.feedback-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--gold-bg);
    color: var(--gold-dark);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.feedback-close:hover,
.feedback-close:focus-visible {
    background: #f5e7b8;
    outline: none;
}

.feedback-lead {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.feedback-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 6px;
}

.feedback-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #e8e0c8;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    color: var(--text-dark);
    background: #fffdf8;
    margin-bottom: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-input:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.feedback-textarea {
    resize: vertical;
    min-height: 120px;
    margin-bottom: 8px;
}

.feedback-status {
    min-height: 1.4em;
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.feedback-status.is-error {
    color: #b42318;
}

.feedback-status.is-success {
    color: #0f7a3f;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.feedback-btn {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.feedback-btn-ghost {
    background: #f4f1ea;
    color: var(--text-dark);
}

.feedback-btn-primary {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(212, 175, 55, 0.28);
}

.feedback-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

body.feedback-open {
    overflow: hidden;
}

/* Keep sun glow animation even when OS prefers reduced motion
   (live zengo.day always plays this effect). Only soften UI transitions. */
@media (prefers-reduced-motion: reduce) {
    .tool-card,
    .ref-card,
    .btn-square,
    .case-highlight-box,
    .nav-menu {
        transition: none !important;
    }
}
