:root {
    --body-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #f3ff4a;
    --secondary-bg: #2a2a2a;
    --border-color: #3a3a3a;
    --highlight-color: #797979;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--body-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    padding: clamp(10px, 5vw, 20px);
    width: 100%;
    height: 100%;
    min-width: 270px;
    max-width: 900px;
    overflow-x: hidden;
}

footer {
    text-align: center;
    padding: 20px 0;
    padding-top: 5vh;
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-color);
    position: sticky;
    top: 100vh;
    left: 0;
    right: 0;
    width: 100%;
}

main {
    margin-top: 20px;
}

a {
    text-decoration: none;
    color: var(--accent-color);
}

a:hover {
    text-decoration: underline;
    cursor: pointer;
}

button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(14px, 4vw, 16px);
    width: 100%;
    max-width: 300px;
}

button:hover {
    opacity: 0.9;
}

input, textarea {
    background-color: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 5px;
    width: 100%;
    font-size: 16px; /* iOS ズーム防止 */
}

code {
    background-color: var(--secondary-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: clamp(12px, 3vw, 14px);
    word-wrap: break-word;
}

ul, ol {
    padding-left: clamp(20px, 5vw, 40px);
    margin: 10px 0;
}

li {
    margin: 0px 0;
}

details {
    background-color: var(--secondary-bg);
    margin: 10px 0px;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
}

section {
    margin-bottom: 40px;
}

details:not(:open) > summary {
    padding: 10px 10px;
}

details:open > summary {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-color);
}

details > div {
    padding: 10px 15px;
    cursor: text;
    user-select: text;
}

table {
    width: 30rem;
    max-width: 100%;
}

th {
    padding: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    text-align: left;
}

td {
    padding: 8px;
    border: 1px solid var(--border-color);
    text-align: left;
}

table > caption {
    caption-side: top;
    text-align: center;
    font-weight: bold;
    margin-bottom: 5px;
}

table.chronology_table {
    width: 100%;
    max-width: 35rem;
    border-collapse: collapse;
    margin: auto;
}

table.chronology_table th {
    text-align: center;
}

table.chronology_table td {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

tbody.achievements > tr > td {
    text-align: center;
    white-space: normal;
}

tbody.achievements > tr > td > span {
    display: inline-block;
}

tbody.achievements > tr > td > span > a {
    padding: 0px 3px;
    color: var(--accent-color);
}

tr.chronology_item {
    scroll-margin-top: 80px;
}

tr.chronology_item > td > a {
    display: flex;
    padding: 8px 8px;
    height: 3rem;
    color: var(--text-color);
    align-items: center;
    justify-content: center;
}

tr.chronology_item:not(.clickable_row):has(td > a:hover) > td > a {
    cursor: default;
    text-decoration: none;
}

tr.chronology_item.clickable_row:has(td > a:hover) > td > a {
    background-color: var(--secondary-bg);
    text-decoration: none;
}

tr.chronology_item > td {
    padding: 0px;
}

@keyframes highlightRow {
  0% {
    background-color: var(--bg-color)
  }
  20% {
    background-color: var(--highlight-color);
  }
  100% {
    background-color: var(--bg-color)
  }
}

tr.chronology_item.is-highlighted > td > a {
  animation: highlightRow 2s ease-out;
}

select {
    background-color: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 5px;
    font-size: clamp(14px, 4vw, 16px);
    width: 100%;
    height: 2.5rem;
    vertical-align: middle;
    max-width: 300px;
    cursor: pointer;
}

.filter_section {
    margin-bottom: 20px;
    text-align: center;
}

/* タブレット以下 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
}

/* モバイル */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    button {
        padding: 12px 16px;
    }
}

.logo {
    color: var(--text-color);
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.touhou_title {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.touhou_title > h2 {
    flex-grow: 1;
}

.touhou_title > div {
    background-color: white;
    float: left;
    flex-grow: 0;
    margin: 0.4rem 0.4rem 0.6rem 0.0rem;
    margin-top: 0.6rem;
    width: 1rem;
    height: 1rem;
    user-select: none;
    color: transparent;
}

.achievements {
    line-height: 1rem;
}

.box {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

.link_box {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    position: relative;
}

.link_box > a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.link_box > .mask {
    position: absolute;
    top: 50%;
    left: 50%;
    text-align: center;
    vertical-align: middle;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: clamp(12px, 3vw, 14px);
    opacity: 0;
    transition: all 0.3s ease;
}

.link_box:hover {
    border-color: var(--border-color);
    background-color: var(--secondary-bg);
}

.link_box:hover > .mask {
    opacity: 1;
}

.fixed_nav {
    position: fixed;
    font-size: small;
    top: 10px;
    left: 10px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px 5px;
    z-index: 1000;
}

.table_of_contents {
    background-color: var(--secondary-bg);
    border-radius: 5px;
    margin-bottom: 20px;
    padding: 10px;
}

.chronology_table td > .touhou_title {
    align-items: center;
    justify-content: center;
    display: flex;
}

.chronology_table td > .touhou_title > div {
    background-color: white;
    float: left;
    flex-grow: 0;
    margin: 0.2rem 0.4rem 0.2rem 0;
    width: 0.9rem;
    height: 0.9rem;
    user-select: none;
    color: transparent;
}

.url {
    display: none;
    font-size: clamp(10px, 2.5vw, 12px);
    color: var(--text-color);
}

.date {
    font-size: clamp(10px, 2.5vw, 12px);
    color: var(--text-color);
    text-align: right;
}

.context {
    border-left: 6px solid var(--border-color);
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
}

.wip {
    opacity: 0.5;
    cursor: not-allowed;
}

.wip > a {
    pointer-events: none;
}
